#include <bits/stdc++.h>
const long long N = 1e6;
const long long P = 1e9 + 7;
long long fac[N + 10], n, ans;
long long qpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % P;
    a = a * a % P;
    b >>= 1;
  }
  return res;
}
signed main() {
  scanf("%lld", &n);
  long long ans = 1;
  for (long long i = 1; i <= n; i++) ans = ans * i % P;
  long long ans2 = qpow(2, n - 1);
  printf("%lld\n", ((ans - ans2) % P + P) % P);
  return 0;
}
