#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  long long int ans = 1;
  long long int mod = (long long int)(1e9 + 7);
  for (int i = 1; i <= n; i++) {
    ans = (ans * i) % mod;
  }
  long long int sub = 1;
  for (int i = 1; i < n; i++) {
    sub = (sub * 2) % mod;
  }
  ans = ((ans - sub) % mod + mod) % mod;
  std::cout << ans << "\n";
  return 0;
}
