#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=(1e6)+10;
const ll mod=(1e9)+7;
int n;
ll jc[maxn],ivjc[maxn],iv[maxn],ans;
ll c(ll a,ll b) {
	if (a<b) return 0;
	ll res=jc[a]*ivjc[b]%mod*ivjc[a-b]%mod;
	return res;
}
int main() {
	//freopen("1.txt","r",stdin);
	scanf("%d",&n);
	jc[0]=ivjc[0]=1;
	for (int i=1;i<=n;i++) {
		jc[i]=jc[i-1]*i%mod;
		iv[i]=(mod-iv[mod%i]*(mod/i)%mod)%mod;
		if (i==1) iv[1]=1;
		ivjc[i]=ivjc[i-1]*iv[i]%mod;
	}
	ll lst=0;
	for (int s=max(1,n/2-1);s<n;s++) {
		ll tmp=jc[s]*jc[n-s-1]%mod*c(s-1,n-s-1)%mod;
		ans+=((tmp-lst+mod)%mod)*s%mod;
		lst=tmp;
		ans%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}