#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265359;
inline long long add(long long a, long long b, long long m) {
  if ((a + b) >= m) return (a + b) % m;
  return a + b;
}
inline long long mul(long long a, long long b, long long m) {
  if ((a * b) < m) return a * b;
  return (a * b) % m;
}
long long power(long long x, long long y, long long m) {
  long long res = 1;
  x = x % m;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % m;
    y = y >> 1;
    x = (x * x) % m;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio;
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> fact(n + 1), inv(n + 1);
    fact[0] = inv[0] = 1;
    for (long long i = 1; i < n + 1; i++) {
      fact[i] = (fact[i - 1] * i) % 1000000007;
      inv[i] = power(fact[i], 1000000007 - 2, 1000000007);
    }
    long long ans = 0;
    for (long long i = 0; i < n; i++) {
      long long x = inv[i];
      x = (x * inv[n - 1 - i]) % 1000000007;
      x = (x * fact[n - 1]) % 1000000007;
      ans = (ans + x) % 1000000007;
    }
    cout << (fact[n] - ans + 1000000007) % 1000000007 << endl;
  }
  return 0;
}
