#include <bits/stdc++.h>
using namespace std;
long long n;
long long mod = 1000000007;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  while (cin >> n) {
    long long ret = 1;
    for (long long i = 1; i <= n; ++i) {
      ret *= i;
      ret %= mod;
    }
    long long minus = 1;
    for (int i = 1; i < n; ++i) {
      minus <<= 1;
      minus %= mod;
    }
    ret += mod;
    cout << (ret - minus) % mod << endl;
  }
}
