#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MN = 1000100;
const ll M = 1e9+7;
ll mul(ll a, ll b) {
	return (a*b)%M;
}
ll bp(ll b, ll p) {
	ll ac = 1;
	while(p) {
		if(p&1) {ac = mul(ac,b);}
		b = mul(b,b);
		p >>= 1;
	}
	return ac;
}
ll inv(ll v) {return bp(v,M-2);}
ll fp[MN];
ll fac(ll n) {
	if(n <= 1) {return 1;}
	if(n >= 10000) {fac(n-10000);}
	if(fp[n] != -1) {return fp[n];}
	return fp[n] = mul(n,fac(n-1));
}
ll ch(ll n, ll k) {
	return mul(fac(n),mul(inv(fac(k)),inv(fac(n-k))));
}
int main() {
	ll n;
	cin >> n;
	memset(fp,-1,sizeof(fp));
	ll res = 0;
	ll rs = 0;
	for(int i=0;i<=n-2;i++) {
		if(i >= n-i-2) {
			ll ro = ch(i,n-i-2);
			ro = mul(ro,fac(i+1));
			ro = mul(ro,fac(n-2-i));
			ro -= rs;
			if(ro < 0) {ro += M;}
			rs += ro;
			if(rs >= M) {rs -= M;}
			res += mul(ro,i+1);
		}
	}
	res %= M;
	cout << res << '\n';
}
