#include <bits/stdc++.h>
using namespace std;
const int Mod = (int)1e9 + 7;
inline int add(int x, int y) {
  return ((int)((1ll * ((int)((x) % Mod)) + ((int)((y) % Mod)) + (Mod << 1)) %
                Mod));
}
inline int sub(int x, int y) {
  return ((int)((1ll * ((int)((x) % Mod)) - ((int)((y) % Mod)) + (Mod << 1)) %
                Mod));
}
inline int mul(int x, int y) {
  return (int)((
      int)((1ll * (((int)((x) % Mod)) + Mod) * (((int)((y) % Mod)) + Mod)) %
           Mod));
}
inline int pow(int x, long long y) {
  int res = 1;
  while (y) {
    if (y & 1ll) res = mul(res, x);
    x = mul(x, x), y >>= 1ll;
  }
  return res;
}
inline int inv(int x) { return pow(x, 1ll * Mod - 2); }
inline int dv(int x, int y) { return mul(x, inv(y)); }
const int MAXFAC = (int)2e6 + 10;
int fac[MAXFAC];
void init_fac(int maxn) {
  fac[0] = 1;
  for (int i = 1; i < maxn; ++i) fac[i] = mul(fac[i - 1], i);
}
inline int C(int n, int r) { return dv(fac[n], mul(fac[n - r], fac[r])); }
void preproc() { init_fac(MAXFAC); }
void solve() {
  int N;
  cin >> N;
  cout << sub(fac[N], pow(2, 1ll * N - 1)) << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  preproc();
  int tc = 1;
  for (int Tt = 1; Tt <= tc; ++Tt) {
    solve();
  }
  return EXIT_SUCCESS;
}
