#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-parameter"
using namespace std;
const int maxN = 1e6 + 10;
const int maxM = 20;
const int maxP = 1e4 + 10;
const long long INF_LL = 1e17;
const int INF = 1e9 + 100;
const int MOD = 1e9 + 7;
const int Base = 30;
const long double EPS = 1e-9;
const int BLOCK = 1000;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd_64(chrono::steady_clock::now().time_since_epoch().count());
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
void open_file() {}
int power(int a, int n) {
  int res = 1;
  for (; n; n >>= 1, a = 1LL * a * a % MOD) {
    if (n & 1) {
      res = 1LL * res * a % MOD;
    }
  }
  return res;
}
int inverse(int a) { return power(a, MOD - 2); }
int fact[maxN];
void sol() {
  int n;
  cin >> n;
  fact[0] = 1;
  for (int i = 1; i <= n; i++) fact[i] = 1LL * fact[i - 1] * i % MOD;
  cout << (fact[n] - power(2, n - 1) + MOD) % MOD;
}
void solve() {
  int T;
  T = 1;
  int TestCase = 0;
  while (T--) {
    TestCase += 1;
    sol();
  }
}
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  open_file();
  solve();
}
