#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    long long int ans = 1;
    for (int i = 1; i <= n; i++) ans = (ans * i) % 1000000007;
    long long int term = 1;
    for (int i = 1; i < n; i++) term = (term * 2) % 1000000007;
    ans = (ans - term + 1000000007) % 1000000007;
    cout << ans << "\n";
  }
}
