#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 100;
const int S = 1e6 + 5;
const int MOD = 1e9 + 7;
long long fac[S] = {0};
long long dp[S] = {0};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  fac[2] = 2;
  dp[2] = 0;
  for (int i = 3; i <= n; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    dp[i] = fac[i] - 2 * (fac[i - 1] - dp[i - 1]);
    dp[i] %= MOD;
    dp[i] += MOD;
    dp[i] %= MOD;
  }
  cout << dp[n] << '\n';
  return 0;
}
