#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m, k;
  long long t;
  cin >> n;
  long long fct = 1;
  long long pw = 1;
  for (long long i = 2; i <= n; i++) {
    fct = ((fct % 1000000007) * (i % 1000000007)) % 1000000007;
    pw = ((pw % 1000000007) * 2) % 1000000007;
  }
  cout << ((fct - pw) + 1000000007) % 1000000007 << '\n';
  return 0;
}
