#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.tie(0);
  long long n;
  cin >> n;
  const long long mod = 1e9 + 7;
  long long perm = 1;
  for (long long i = 1; i <= n; i++) {
    perm = (perm * i) % mod;
  };
  perm = (perm - 1 + mod) % mod;
  long long mn = 1;
  for (int i = 1; i < n; i++) {
    perm = (perm - mn + mod) % mod;
    mn = (mn * 2) % mod;
  }
  cout << perm << '\n';
}
