#include <bits/stdc++.h>
using namespace std;
#define MAXN 1000000
#define MOD 1000000007
#define rint register int
#define gc() getchar()
inline int read(int r=0,int s=0,int c=gc()){for(;c<48||c>57;s=c,c=gc());for(;c>=48&&c<=57;(r*=10)+=c-48,c=gc());return s^'-'?r:-r;}
inline int fxp(int s, int n=MOD-2){int a=1; for(; n; n&1 ? a = 1ll*a*s%MOD : 0, s = 1ll*s*s%MOD, n >>= 1); return a;}
int fac[MAXN+5], efac[MAXN+5], f[MAXN+5], s[MAXN+5], n, Ans; inline int C(int n, int k){return n<0||k<0||n<k?0:1ll*fac[n]*efac[k]%MOD*efac[n-k]%MOD;}
int main()
{
	n = read(); for(rint i = fac[0] = 1; i <= n; fac[i] = 1ll*i*fac[i-1]%MOD, i++); efac[n] = fxp(fac[n]); for(rint i = n; i; efac[i-1] = 1ll*i*efac[i]%MOD, i--);
	for(rint i = 1; i <= n; f[i] = 1ll*C(i-1,n-i-1)*fac[i]%MOD*fac[n-1-i]%MOD, f[i] = (f[i]+MOD-s[i-1])%MOD, s[i] = (s[i-1]+f[i])%MOD, i++);
	for(rint i = 1; i < n; Ans = (Ans+1ll*i*f[i])%MOD, i++); printf("%d\n",Ans); return 0;
}