#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 10, mod = 1e9 + 7;
long long pow_mod(long long x, long long n, long long mod) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
long long fac[N];
signed main() {
  fac[0] = 1;
  for (long long i = 1; i <= N - 10; i++) fac[i] = fac[i - 1] * i % mod;
  long long n;
  cin >> n;
  cout << (fac[n] - pow_mod(2, n - 1, mod) + mod) % mod << '\n';
  return 0;
}
