#include <bits/stdc++.h>
using namespace std;
long long SET(long long N, long long pos) {
  return N = N | ((long long)1 << pos);
}
long long RESET(long long N, long long pos) {
  return N = N & ~((long long)1 << pos);
}
bool CHECK(long long N, long long pos) {
  return (bool)(N & ((long long)1 << pos));
}
template <typename T>
inline T __lcm(T a, T b) {
  return (a * b) / __gcd(a, b);
}
struct node {
  long long i, x, y;
};
long long dx[] = {0, 1, 0, -1, -1, 1, -1, 1};
long long dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
void solve() {
  long long n;
  cin >> n;
  long long ans = 1;
  for (long long i = 1; i <= n; i++) {
    ans *= i;
    ans %= 1000000007;
  }
  long long ans2 = 1;
  for (long long i = 0; i < n - 1; i++) {
    ans2 *= 2;
    ans2 %= 1000000007;
  }
  ans = ans - ans2;
  ans += 1000000007;
  ans %= 1000000007;
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
