#include <bits/stdc++.h>
using namespace std;
const long long int M = (long long int)2e5 + 5;
const long long int mod = (long long int)1e9 + 7;
long long int powM(long long int b, long long int p) {
  long long int ans = 1;
  while (p) {
    if (p % 2LL) ans = (ans * b) % mod;
    b = (b * b) % mod;
    p /= 2LL;
  }
  return ans;
}
long long int fact(long long int n) {
  long long int ans = 1;
  for (long long int i = 1; i < n + 1; i++) ans = (ans * i) % mod;
  return ans;
}
void solve() {
  long long int n;
  cin >> n;
  long long int a = fact(n), b = powM(2, n - 1);
  cout << ((a - b + mod) % mod + mod) % mod << "\n";
}
int32_t main() {
  {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  long long int t = 1;
  for (long long int tno = 1; tno < t + 1; tno++) {
    solve();
  }
  return 0;
}
