#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long power(long long a, long long b) {
  long long res = 1;
  while (b != 0) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b = b / 2;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  long long f = 1;
  for (int i = 1; i <= n; i++) {
    f = (f * i) % mod;
  }
  long long p = power(2, n - 1);
  long long ans = (f - p + mod) % mod;
  cout << ans << "\n";
}
