#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};
struct node {
  int num;
  int v;
  long long w;
};
struct cmp1 {
  bool operator()(node x, node y) { return x.num < y.num; }
};
priority_queue<node, vector<node>, cmp1> q1;
const int Maxn = 100 + 10;
const long long mod = 1000000000 + 7;
long long gcd(long long a, long long b) {
  long long c;
  c = a % b;
  while (c) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}
long long fpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
int main() {
  long long n;
  scanf("%lld", &n);
  long long sum = 1;
  for (long long i = 2; i <= n; i++) {
    sum *= i;
    sum %= mod;
  }
  long long temp = fpow(2, n - 1) % mod;
  sum -= temp;
  sum += mod;
  printf("%lld\n", sum % mod);
  return 0;
}
