#include <bits/stdc++.h>
using namespace std;
const int N = 1e9 + 7;
long long n, jem = 1, res = 1;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= (n); i++) jem = jem * 1ll * i % N;
  for (long long i = 1; i <= (n - 1); i++) res = res * 2ll % N;
  cout << (jem - res + N) % N;
}
