#include <iostream>
#include <algorithm>
#include <cstdio>
#define MAXN 2000005
#define LL long long
#define mod 1000000007
using namespace std;

int n;
LL fac[MAXN], inv[MAXN], ans, last;

int main()
{
    scanf("%d", &n);
    fac[0]=fac[1]=1; inv[0]=inv[1]=1;
    for(int i=2; i<=n; i++) fac[i]=(fac[i-1]*i)%mod;
    for(int i=2; i<=n; i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
    for(int i=2; i<=n; i++) inv[i]=inv[i-1]*inv[i]%mod;
    for(int i=(n+1)/2; i<n; i++)
    {
        LL com=fac[i-1]*inv[n-i-1]%mod*inv[2*i-n]%mod;
        LL temp=com*fac[i]%mod*fac[n-i-1]%mod;
        ans=(ans+(mod+temp-last)%mod*i)%mod;
        last=temp;
    }
    printf("%lld\n", ans);
}