#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
void sol() {
  long long n;
  cin >> n;
  long long ans = 1;
  long long pre = 0;
  long long dif = 0;
  for (int i = 1; i <= n; ++i) {
    ans = (ans * i) % mod;
    dif = (pre + 1) % mod;
    pre = (pre + dif) % mod;
  }
  cout << (ans - dif + mod) % mod << "\n";
}
int main() {
  int tc = 1;
  while (tc--) {
    sol();
  }
}
