#include <bits/stdc++.h>
using namespace std;
void Input_Preparing() {}
void Solver() {
  long long int n;
  cin >> n;
  long long int res, fact;
  fact = 1;
  res = 1;
  for (long long int i = 1; i <= n - 1; i++) {
    res *= 2;
    fact *= i;
    fact %= 1000000007;
    res %= 1000000007;
  }
  fact *= n;
  fact %= 1000000007;
  fact -= res;
  fact %= 1000000007;
  if (fact < 0) fact += 1000000007;
  cout << fact;
}
void Processing() { Solver(); }
int main() {
  std::cin.tie(0)->sync_with_stdio(0);
  ;
  Processing();
  return 0;
}
