#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll M = 1000000007;
int n;
ll f[1000002];
int power(ll a) {
  if (a == 1) return 1;
  ll k = 1;
  int p = M - 2;
  while (p) {
    if (p & 1) k = k * a % M;
    p >>= 1;
    a = a * a % M;
  }
  return k;
}
int main() {
  cin >> n;
  f[0] = f[1] = 1;
  for (ll i = 2; i <= n; i++) f[i] = f[i - 1] * i % M;
  ll ans = f[n];
  for (int i = 0; i < n; i++) {
    ll l = (f[n - 1] * power(f[i])) % M * power(f[n - 1 - i]) % M;
    ans -= l;
    if (ans < 0) ans += M;
  }
  cout << ans;
}
