#include <bits/stdc++.h>
using namespace std;
inline const char nl = '\n';
inline const long long MOD = 1000000007;
inline const long double pi = 3.141592653589793238;
long long fscn() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  long long sg = 0;
  if (c == '-') {
    c = getchar();
    sg = 1;
  }
  long long ret = 0;
  while (c >= '0' && c <= '9') {
    ret = ret * 10 + c - '0';
    c = getchar();
  }
  return sg ? -ret : ret;
}
long long power(long long x, unsigned long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
void solve() {
  long long n = fscn();
  long long fact = 1;
  for (long long i = 1; i < n + 1; i++) {
    fact = (fact * i) % MOD;
  }
  long long x = (fact - power(2, (n - 1), MOD)) % MOD;
  cout << (x < 0 ? (MOD + x) : x) << nl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  solve();
  return 0;
}
