#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#define MN 1000000
#define mod 1000000007
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,p[MN+5],inv[MN+5],ans;
inline int C(int n,int m){return m<=n?1LL*p[n]*inv[m]%mod*inv[n-m]%mod:0;}
int main()
{
    n=read();p[0]=p[1]=inv[0]=inv[1]=1;
    for(int i=2;i<=MN;++i) p[i]=1LL*p[i-1]*i%mod,inv[i]=1LL*(mod-mod/i)*inv[mod%i]%mod;
    for(int i=2;i<=MN;++i) inv[i]=1LL*inv[i-1]*inv[i]%mod;
    ans=1LL*p[n-1]*(n-1)%mod;
    for(int i=2;i<n;++i) ans=(ans-1LL*C(i-2,(n-2-(i-2)))*p[i-1]%mod*p[n-i]%mod+mod)%mod;
    cout<<ans;
    return 0;
}
