#include <bits/stdc++.h>
using namespace std;
void debug_out();
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T);
long long fact[1000005];
long long fact1[1000005];
void computeFactorial() {
  fact[0] = 1;
  for (long long i = 1; i < 1000005; i++)
    fact[i] = (fact[i - 1] * i) % 1000000007;
  fact1[0] = 1;
  for (long long i = 1; i < 1000005; i++)
    fact1[i] = (fact1[i - 1] * 2) % 1000000007;
}
long long run_test() {
  long long n;
  cin >> n;
  if (n == 1 || n == 2) {
    cout << 0 << "\n";
    return 0;
  }
  long long t1 = fact[n];
  long long t2 = fact1[n - 1];
  long long ans = (t1 - t2 + 1000000007) % 1000000007;
  cout << ans << "\n";
  return 0;
}
int32_t main() {
  computeFactorial();
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  long long t = 1;
  for (long long tc = 1; tc < t + 1; tc++) {
    long long stat = run_test();
  }
  return 0;
}
