#include <bits/stdc++.h>
using namespace std;
long long int fact[1000001];
long long int pow1[10000001];
long long int mod = 1e9 + 7;
int main() {
  fact[0] = 1;
  pow1[0] = 1;
  pow1[1] = 2;
  fact[1] = 1;
  for (int i = 2; i <= 1000000; i++) {
    fact[i] = (fact[i - 1] * i) % mod;
    pow1[i] = (pow1[i - 1] * 2) % mod;
  }
  long long int n;
  cin >> n;
  cout << (((fact[n] - pow1[n - 1]) % mod) + mod) % mod;
}
