#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9, oo = 1e9;
long long power(long long x) {
  if (x == 0) return 1;
  long long n = power(x / 2);
  n = (n * n) % 1000000007;
  if (x % 2) n *= 2;
  return n % 1000000007;
}
void solve() {
  long long n;
  cin >> n;
  long long ans = n;
  for (int i = 1; i < n; i++) {
    ans *= i;
    ans %= 1000000007;
  }
  cout << (ans - power(n - 1) + 1000000007) % 1000000007 << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) solve();
}
