#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, fact = 1, acy = 1, i;
  cin >> n;
  int p = 1000000007;
  for (i = 1; i <= n; i++) {
    fact = (fact % p * i % p) % p;
  }
  for (i = 1; i <= n - 1; i++) {
    acy = ((acy % p) * 2) % p;
  }
  fact %= p;
  fact = fact - acy;
  fact %= p;
  if (fact < 0) fact += p;
  cout << fact;
  return 0;
}
