#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i += 6) {
    if ((n % i == 0) || (n % (i + 2) == 0)) return false;
  }
  return true;
}
long long mod = 1e9 + 7;
long long powermod(long long x, long long y) {
  long long res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
int32_t main() {
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long r = 1;
    long long p = 1;
    for (long long i = 2; i <= n; i++) {
      r = (r * i) % mod;
      p = (p * 2) % mod;
    }
    cout << (r - p + mod) % mod;
  }
}
