#include <bits/stdc++.h>
const int N = 1e6 + 4;
const int mod = 1e9 + 7;
using namespace std;
long long me(long long n, long long p) {
  long long res = 1;
  while (p) {
    if (p % 2 == 1) res = (res * n) % mod;
    n = (n * n) % mod;
    p = p / 2;
  }
  return res;
}
int main() {
  int t = 1;
  long long fac[N];
  fac[0] = 1;
  for (int i = 1; i < N; i++) {
    fac[i] = (i * fac[i - 1]) % mod;
  }
  while (t--) {
    int n;
    cin >> n;
    long long ans = (fac[n] - me(2, n - 1) + mod) % mod;
    cout << ans;
  }
}
