#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, n, m, k, x, y, l1, l2, r1, r2, z, sum = 0, mx, mn, count,
                                                    flag = 0, pointer = 0;
  cin >> n;
  x = y = 1;
  for (i = 1; i <= n; i++) {
    x *= i;
    x %= 1000000007;
  }
  for (i = 1; i < n; i++) {
    y *= 2;
    y %= 1000000007;
  }
  sum = x - y + 1000000007;
  sum %= 1000000007;
  cout << sum;
  return 0;
}
