#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000007;
long long int MOD1 = 998244353;
mt19937 tw(chrono::high_resolution_clock::now().time_since_epoch().count());
unsigned long long power(unsigned long long x, int y, int p) {
  unsigned long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
void solve() {
  long long int n;
  cin >> n;
  long long int res = 1;
  for (int i = 1; i <= n; i++) {
    res = (res * i) % MOD;
  }
  long long int p = power(2, n - 1, MOD);
  res = (res - p + MOD) % MOD;
  cout << res << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
