#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vector<ll> >;
using vpi = vector<pair<ll, ll> >;
using pi = pair<ll, ll>;
using st = set<ll>;
using stk = stack<ll>;
using kiwi = queue<ll>;
using mp = map<ll, ll>;
using ump = unordered_map<ll, ll>;
const ll mx = 1e5 + 123;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  ll n;
  cin >> n;
  ll pw = 1, ans = 1;
  for (ll i = 2; i <= n; ++i)
    ans = ans * i % 1000000007, pw = pw * 2 % 1000000007;
  cout << (ans - pw + 1000000007) % 1000000007 << endl;
  return 0;
}
