#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
void solve() {
  long long n;
  cin >> n;
  long long res1 = 1, res2 = 1;
  for (int i = 1; i <= n; i++) {
    res1 *= i;
    res1 %= mod;
    if (i != n) {
      res2 *= 2;
      res2 %= mod;
    }
  }
  long long ans = res1 - res2;
  if (ans < 0) ans += mod;
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  solve();
  return 0;
}
