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