#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long bin_to_integer(string s) {
  long long r = 1, sum = 0;
  for (long long i = s.length() - 1; i >= 0; i--) {
    if (s[i] == '1') {
      sum += r;
    }
    r *= 2;
  }
  return sum;
}
string to_binary(int n) {
  string s;
  while (n > 0) {
    if (n & 1) {
      s += '1';
    } else {
      s += '0';
    }
    n >>= 1;
  }
  reverse(s.begin(), s.end());
  return s;
}
int compare(const void* a, const void* b) {
  const long long* x = (long long*)a;
  const long long* y = (long long*)b;
  if (*x > *y)
    return 1;
  else if (*x < *y)
    return -1;
  return 0;
}
long long fact(long long int x) {
  if (x == 1)
    return 1;
  else
    return ((x * fact(x - 1)) % mod);
}
void solve() {
  long long n;
  cin >> n;
  long long factril = 1, n2 = n, twopow = 1;
  while (n2 > 0) {
    factril = (factril * n2) % mod;
    n2--;
  }
  n2 = n - 1;
  while (n2--) {
    twopow = twopow * 2 % mod;
  }
  long long ans = factril - twopow;
  if (ans % mod < 0) ans += mod;
  cout << ans % mod << endl;
  return;
}
int main() {
  int t = 1, z = 1;
  while (z <= t) {
    solve();
    z++;
  }
  return 0;
}
