#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll p=1e9+7;
ll n,ans,jc[1000010],ny[1000010],f[1000010];
ll ksm(ll x,ll y){
	ll xlh=1;
	while(y){
		if(y&1)xlh=xlh*x%p;
		x=x*x%p;
		y/=2;
	}
	return xlh;
}
ll C(ll x,ll y){
	if(x<y)return 0;
	return jc[x]*ny[y]%p*ny[x-y]%p;
}
int main(){
	ll i;
	scanf("%lld",&n);
	jc[0]=ny[0]=1;
	for(i=1;i<=n;i++)jc[i]=jc[i-1]*i%p;
	ny[n]=ksm(jc[n],p-2);
	for(i=n-1;i;i--)ny[i]=ny[i+1]*(i+1)%p;
	n--;
	for(i=1;i<=n;i++){
		f[i]=C(i-1,n-i)*jc[i]%p*jc[n-i]%p;
	}
	for(i=n;i;i--){
		f[i]=(f[i]-f[i-1]+p)%p;
		ans=(ans+f[i]*i)%p;
	}
	printf("%lld",ans);
}