#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long Pow(long long n, int k) {
  if (k == 0) return 1;
  long long tmp = Pow(n, k / 2) % MOD;
  tmp = (tmp * tmp) % MOD;
  if (k % 2)
    return tmp * n % MOD;
  else
    return tmp;
}
int main() {
  int n;
  cin >> n;
  long long res = 1;
  for (int i = 1; i <= n; i++) res = (long long)(res * i) % MOD;
  res = (res - Pow(2, n - 1) + MOD) % MOD;
  cout << res;
  return 0;
}
