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