#include <bits/stdc++.h>
using namespace std;
long long fact(long long n) {
  long long f = 1;
  for (long long i = 2; i <= n; i++) {
    f = (f * i) % 1000000007;
  }
  return f;
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (res % 1000000007 * a % 1000000007) % 1000000007;
    }
    a = (a % 1000000007 * a % 1000000007) % 1000000007;
    b = b / 2;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  long long val = fact(n);
  long long temp = power(2, n - 1);
  cout << (val - temp + 1000000007) % 1000000007 << "\n";
}
