#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long expo(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long ret = expo(a, b / 2);
    ret = (ret * ret) % 1000000007;
    return ret;
  } else {
    long long ret = expo(a, b / 2);
    ret = (ret * ret) % 1000000007;
    ret = (ret * a) % 1000000007;
    return ret;
  }
}
bool is_prime(int x) {
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
long long inf = 1e18;
long long fac[1000001];
long long power[1000001];
int main() {
  long long n;
  cin >> n;
  fac[0] = 1;
  power[0] = 1;
  for (int i = 1; i <= 1000000; i++) {
    fac[i] = (fac[i - 1] * i) % 1000000007;
    power[i] = (power[i - 1] * 2) % 1000000007;
  }
  cout << (fac[n] - power[n - 1] + 1000000007) % 1000000007;
}
