#include <bits/stdc++.h>
using namespace std;
long long int m = 1000000007;
void solve() {
  long long int n;
  cin >> n;
  long long int sum = 1, power[n + 1];
  power[0] = 1;
  power[1] = 2;
  for (long long int i = 2; i < n + 1; i++) {
    sum = (sum * i) % m;
    power[i] = (power[i - 1] * 2) % m;
  }
  long long int ans = (sum - power[n - 1] + m) % m;
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
