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