#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long n, a, b;
int main() {
  scanf("%lld", &n);
  a = 1, b = 1;
  for (int i = 2; i <= n; ++i) a = a * i % mod, b = b * 2 % mod;
  printf("%lld\n", (a - b + mod) % mod);
  return 0;
}
