#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  if (n == 2) {
    cout << 1 << endl;
    return 0;
  }
  long long int s = 1;
  for (int i = 2; i < n; i++) {
    s = (s * i) % 1000000007;
  }
  s = s * (n - 1) % 1000000007;
  long long int t = 1;
  for (int i = 2; i <= n - 2; i++) {
    t = t * i % 1000000007;
  }
  t = t * (n - 3) % 1000000007;
  long long int u = s - t;
  if (u < 0) {
    u = u + 1000000007;
  }
  cout << u << endl;
  return 0;
}
