#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
long long n;
int main() {
  cin >> n;
  long long x = 1;
  long long y = 1;
  for (long long i = 1; i <= n; i++) {
    x = x * i % 1000000007;
    if (i != 1) y = y * 2 % 1000000007;
  }
  cout << (x - y + 1000000007) % 1000000007 << endl;
}
