#include<iostream>
#define int long long
using namespace std;
const int N=1e6+2;
const int mod=1e9+7;
int fact[N],inv[N];
int binpow(int x,int y){
	int tich=1;
	while(y){
		if((y&1)){
			tich*=x;
			tich%=mod;
		}
		x*=x;
		x%=mod;
		y>>=1;
	}
	return tich;
}
int C(int x,int y){
	return ((fact[y]*inv[y-x])%mod*inv[x])%mod;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,now=0,ans=0;
	cin>>n;
	fact[0]=1;
	for(i=1;i<=n;i++){
		fact[i]=(fact[i-1]*i)%mod;
		//cout<<fact[i]<<endl;
	}
	inv[n]=binpow(fact[n],mod-2);
	for(i=n;i>=1;i--){
		inv[i-1]=(inv[i]*i)%mod;
		//cout<<inv[i-1]<<endl;
	}
	for(i=(n+1)/2;i<n;i++){
		j=((C(n-i-1,i-1)*fact[i])%mod*fact[n-1-i])%mod;
		//cout<<i<<" "<<j<<endl;
		ans+=((j-now)*i)%mod;
		ans%=mod;
		now=j%mod;
		//cout<<ans<<endl;
	}
	if(ans<0){
		ans+=mod;
	}
	cout<<ans;
}