#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int casei(long long int tc) {
  long long int n, i, trn = 1, fct = 1;
  cin >> n;
  for (i = 1; i <= n; i++) {
    if (i < n) trn *= 2;
    fct *= i;
    trn %= mod;
    fct %= mod;
  }
  long long int ans = fct - trn;
  if (ans < 0) ans += mod;
  cout << ans << "\n";
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int tc, x;
  tc = 1;
  while (tc--) casei(x - tc);
  return 0;
}
