#include <bits/stdc++.h>
using namespace std;
int read() {
  int res = 0, f = 0;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') f++, c = getchar();
  while (isdigit(c)) res = (res << 3) + (res << 1) + (c ^ 48), c = getchar();
  return f ? -res : res;
}
const int mod = 1e9 + 7;
int main() {
  int n = read();
  int ans1 = 1, ans2 = 1;
  for (int i = 1; i <= n; i++) {
    ans1 = 1LL * ans1 * i % mod;
    if (i < n) ans2 = 1LL * ans2 * 2 % mod;
  }
  printf("%d\n", (ans1 - ans2 + mod) % mod);
  return 0;
}
