#include <bits/stdc++.h>
using namespace std;
int n;
long long jc[1000005];
long long qsm(long long x, long long y) {
  long long a = 1;
  long long base = x;
  while (y > 0) {
    if (y & 1) {
      a = (a * base) % 1000000007;
    }
    y >>= 1;
    base = (base * base) % 1000000007;
  }
  return a;
}
int main() {
  cin >> n;
  jc[1] = 1;
  for (int i = 2; i <= n; i++) {
    jc[i] = (jc[i - 1] * i) % 1000000007;
  }
  long long ans;
  ans = (jc[n] - qsm(2, n - 1) + 1000000007) % 1000000007;
  cout << ans;
}
