#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ii = pair<int, int>;
ll const mod = ll(1e9) + 7;
ll fact[1000050];
ll expo(ll a, ll x) {
  ll base = a;
  ll ret = 1;
  while (x) {
    if (x & 1) {
      ret = (ret * base) % mod;
    }
    base = (base * base) % mod;
    x >>= 1;
  }
  return ret;
}
int main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  fact[0] = 1;
  for (int i = (1); i < (n + 1); i++) {
    fact[i] = (fact[i - 1] * i) % mod;
  }
  cout << (mod + fact[n] - expo(2, n - 1)) % mod << endl;
  return 0;
}
