#include <bits/stdc++.h>
using namespace std;
long long f[1000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  f[0] = 1;
  for (int i = 1; i < 1000005; i++) {
    f[i] = f[i - 1] * i;
    f[i] %= 1000000007;
  }
  long long n;
  cin >> n;
  long long pwr = 1;
  for (int i = 1; i < n; i++) {
    pwr *= 2;
    pwr %= 1000000007;
  }
  long long ans = f[n] - pwr;
  ans += 1000000007;
  cout << ans % 1000000007 << endl;
  return 0;
}
