#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 5, N = 1e2 + 5, mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  long long ans = 1;
  for (long long i = 2; i <= n; i++) {
    ans = (ans * i) % mod;
  }
  long long qurwa = 2;
  for (long long i = 3; i <= n; i++) {
    qurwa = (qurwa * 2) % mod;
  }
  cout << ((ans + mod) - qurwa) % mod << endl;
}
