#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 3e6;
const double eps = 0.00000001;
long long ksm(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = ans * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ans;
}
int main() {
  long long c, n, ans;
  std::ios::sync_with_stdio(false);
  cin >> n;
  c = 1;
  for (int i = 1; i <= n; i++) c = c * i % mod;
  ans = (c + mod - ksm(2, n - 1)) % mod;
  cout << ans << endl;
}
