#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, mod = 1e9 + 7, kq1 = 1, kq2 = 1;
  cin >> n;
  for (long long i = 2; i <= n; i++)
    kq1 = (kq1 * i) % mod, kq2 = (kq2 * 2) % mod;
  cout << (kq1 + mod - kq2) % mod;
}
