#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, no = 1, fact = 1;
  cin >> n;
  for (int i = 1; i <= n; ++i) fact = (fact * i) % 1000000007;
  for (int i = 1; i < n; ++i) no = (no * 2) % 1000000007;
  cout << (fact - no + 1000000007) % 1000000007 << '\n';
}
