#include <bits/stdc++.h>
using namespace std;
signed long long N;
const signed long long mo = 1000000007;
signed long long dp[1010101][3];
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N;
  signed long long ret = 1;
  signed long long p2 = 1;
  for (i = 1; i <= N; i++) {
    ret = ret * i % mo;
    if (i < N) p2 = p2 * 2 % mo;
  }
  cout << (ret + mo - p2) % mo << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
