#include <bits/stdc++.h>
using namespace std;
long long dx[8] = {+1, +1, +1, 0, 0, -1, -1, -1};
long long dy[8] = {+1, 0, -1, +1, -1, +1, 0, -1};
void input_File() {}
long long powmod(long long a, long long b, long long p) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % p;
      b--;
    } else {
      a = (a * a) % p;
      b >>= 1;
    }
  }
  return ans;
}
long long fact(long long n) {
  long long ans = 1;
  for (long long i = 1; i <= n; i++)
    ans = (ans % 1000000007 * i % 1000000007) % 1000000007;
  return ans;
}
void solve() {
  long long n;
  cin >> n;
  long long factorial = fact(n);
  long long mountain_pattern = powmod(2, n - 1, 1000000007);
  long long ans = (factorial - mountain_pattern + 1000000007) % 1000000007;
  cout << ans << "\n";
}
signed main() {
  input_File();
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long isTestCasePresent = 0;
  if (isTestCasePresent == 0) {
    long long t = 1;
    while (t--) {
      solve();
    }
  } else {
    long long t;
    cin >> t;
    while (t--) {
      solve();
    }
  }
  return 0;
}
