#include<iostream>
#include<cstdio>
using namespace std;
int n;
int pw[1000010];
int inv[1000010];
const int md=1e9+7;
int qmul(int x,int p)
{
	if(p==0)return 1;
	if(p==1)return x;
	int res=qmul(x,p>>1);
	res=1LL*res*res%md;
	if(p&1)res=1LL*res*x%md;
	return res;
}
int C(int x,int y)
{
	if(x<y)return 0;
	return 1LL*pw[x]*inv[x-y]%md*inv[y]%md;
}
int ans;
int main()
{
	scanf("%d",&n);
	pw[0]=1;
	for(int i=1;i<=n;i++)pw[i]=1LL*pw[i-1]*i%md;
	inv[n]=qmul(pw[n],md-2);
	for(int i=n-1;i>=0;i--)
	{
		inv[i]=1LL*inv[i+1]*(i+1)%md;
	}
	for(int k=1;k<n;k++)
	{
		ans+=1LL*C(k-1,n-1-k)*pw[k]%md*pw[n-1-k]%md;
		if(ans>=md)ans-=md;
	}
	printf("%d",(pw[n]+md-ans)%md);
	return 0;
} 