#include <bits/stdc++.h>
using namespace std;
long long int fact[1000005], pow2[1000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  fact[0] = 1;
  pow2[0] = 1;
  for (int i = 1; i <= 1000005 - 1; i++) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= 1000000007LL;
    pow2[i] = 2 * pow2[i - 1];
    pow2[i] %= 1000000007LL;
  }
  long long int x;
  cin >> x;
  cout << (fact[x] - pow2[x - 1] + 1000000007LL) % 1000000007LL << endl;
}
