#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long int ans = 1;
  long long int temp = 1;
  for (int i = 2; i <= n; i++) {
    ans = (ans * i) % mod;
    temp = (temp * 2) % mod;
  }
  ans = ans - temp;
  while (ans < 0) {
    ans += mod;
  }
  cout << ans << endl;
  return 0;
}
