#include <bits/stdc++.h>
using namespace std;
long long F[1000005];
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y % 2 != 0) res = res * x % p;
    y = y / 2;
    x = x * x % p;
  }
  return res;
}
long long ncr(long long n, long long r, long long p) {
  if (r > n) return 0;
  long long res = F[n];
  res = (res * power(F[r], p - 2ll, p)) % p;
  res = (res * power(F[n - r], p - 2ll, p)) % p;
  return res;
}
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  F[0] = F[1] = 1;
  for (long long i = 2; i < 1000005; i++) F[i] = (F[i - 1] * i) % 1000000007;
  long long n;
  cin >> n;
  long long ans =
      (F[n] - power(2, n - 1, 1000000007) + 1000000007) % 1000000007;
  cout << ans << "\n";
}
