#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, m;
string s[105];
long long pw(long long n, long long k) {
  if (k == 0) return 1;
  if (k == 1) return n;
  long long t = pw(n, k / 2);
  if (k & 1)
    return t * t % mod * n % mod;
  else
    return t * t % mod;
}
void solve() {
  long long n, ans = 1;
  cin >> n;
  for (int i = 1; i <= n; ++i) ans = (ans * i) % mod;
  cout << (ans - pw(2, n - 1) + mod) % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if (fopen("codeforces"
            ".inp",
            "r")) {
    freopen(
        "codeforces"
        ".inp",
        "r", stdin);
    freopen(
        "codeforces"
        ".out",
        "w", stdout);
  }
  long long t = 1;
  while (t--) solve();
}
