#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e6 + 5;
const int MAXN = 105;
long long pw(long long a, long long n) {
  long long rs = 1;
  while (n) {
    if (n & 1) rs = ((rs % 1000000007) * (a % 1000000007)) % 1000000007;
    n >>= 1;
    a = ((a % 1000000007) * (a % 1000000007)) % 1000000007;
  }
  return rs;
}
long long dp[MAX];
int main() {
  long long n;
  cin >> n;
  long long an = 1;
  dp[0] = 1;
  dp[1] = 1;
  dp[2] = 2;
  for (long long i = 2; i <= n; i++) {
    an = (an % 1000000007 * i % 1000000007) % 1000000007;
    dp[i] = an;
  }
  an -= pw(2, n - 1);
  an += 1000000007;
  an %= 1000000007;
  cout << an << endl;
}
