#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll Max = 1000000007;
ll factMap[1000000];
ll fact(int n) {
  if (n == 1 || n == 0) return 1;
  if (factMap[n] != 0) return factMap[n];
  factMap[n] = fact(n - 1);
  return factMap[n];
}
ll bin(int size, int n) {
  if (n == 1) return size;
  if (n == 0) return 1;
  return size * bin(size - 1, n - 1);
}
int main() {
  int n;
  cin >> n;
  auto needs = n / 2 + n % 2;
  ll score = 0;
  for (auto m = n - 1; m >= needs; m--) {
    score += m * bin(m, n - 1 - m) * fact(m) % Max * fact(n - m) % Max;
    score %= Max;
    cerr << score << endl;
  }
  cout << score << endl;
}
