#include <bits/stdc++.h>
using namespace std;
inline long long add(long long a, long long b) {
  return ((a % 1000000007) + (b % 1000000007)) % 1000000007;
}
inline long long mul(long long a, long long b) {
  return ((a % 1000000007) * (b % 1000000007)) % 1000000007;
}
inline long long sub(long long a, long long b) {
  return ((a % 1000000007) - (b % 1000000007) + 1000000007) % 1000000007;
}
const long long N = 1e6 + 7;
long long fac[N];
void pre() {
  fac[0] = 1;
  fac[1] = 1;
  for (long long i = 2; i < N - 5; i++) fac[i] = mul(i, fac[i - 1]);
}
long long power(long long x, unsigned long long y, long long p = 1000000007) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res % p;
}
void solve() {
  long long n;
  cin >> n;
  long long ans = fac[n];
  ans = sub(ans, power(2, n - 1));
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  pre();
  long long t = 1;
  for (long long a = 0; a < t; a++) {
    solve();
  }
}
