#include <bits/stdc++.h>
using namespace std;
int const N = 1e6 + 1;
long long mod = 1e9 + 7;
long long fact[N];
long long powmod(long long a, long long b, long long p) {
  a %= p;
  if (a == 0) return 0;
  long long product = 1;
  while (b > 0) {
    if (b & 1) {
      product *= a;
      product %= p;
      --b;
    }
    a *= a;
    a %= p;
    b /= 2;
  }
  return product;
}
long long inv(long long a, long long p) { return powmod(a, p - 2, p); }
long long nCk(long long n, long long k, long long p) {
  return ((fact[n] * inv(fact[k], p) % p) * inv(fact[n - k], p)) % p;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  fact[0] = 1;
  for (int i = (1); i < (N); ++i) {
    fact[i] = fact[i - 1] * (long long)i;
    fact[i] %= mod;
  }
  cin >> n;
  long long ans = fact[n];
  for (int i = (0); i < (n); ++i) {
    ans -= nCk(n - 1, i, mod);
    ans += mod;
    ans %= mod;
  }
  cout << ans << '\n';
  return 0;
}
