#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
void self_add(long long &x, long long y) { x = (x + y) % mod; }
long long binpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = (res * a) % mod;
    n >>= 1;
    a = (a * a) % mod;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  long long fact = 1;
  for (long long i = 2; i <= n; i++) {
    fact = (fact * (i)) % mod;
  }
  long long power = binpow(2, n - 1);
  long long ans = (fact - power) % mod;
  if (ans < 0) ans += mod;
  cout << ans;
  return 0;
}
