#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
char a[109][109];
long long fac[1000009];
long long quick_pow(long long x, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = ans * x % mod;
    n >>= 1;
    x = x * x % mod;
  }
  return ans;
}
long long c(long long n, long long m) {
  if (m == 0) return 1;
  return fac[n] * quick_pow(fac[n - m] * fac[m] % mod, mod - 2) % mod;
}
signed main() {
  long long n;
  cin >> n;
  fac[0] = 1;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % mod;
  for (long long i = 1; i <= n; i++) {
    long long temp = c(n - 1, i - 1) % mod;
    ans = (ans + temp) % mod;
  }
  cout << (fac[n] - ans + mod) % mod;
}
