#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define MOD 1000000007
LL powmod(LL a, LL n){
    if(n == 0) return 1;
    if(n % 2) return (a*powmod(a,n-1)) % MOD;
    LL c = powmod(a, n/2);
    return (c*c) % MOD;
}
LL inv(LL a){
    return powmod(a, MOD-2);
}
LL fact[1100000];
LL invfact[1100000];
 
void init(){
    fact[0] = 1;
    invfact[0] = 1;
    for(LL i = 1; i < 1100000; i++){
        fact[i] = (i*fact[i-1]) % MOD;
        invfact[i] = inv(fact[i]);
    }
}
 
int main(){
	init();
	LL n;
	cin >> n;
	LL ans = (n-1) * fact[n-1];
	ans %= MOD;
	LL k = n-2;
	for(LL a = 1; a*2 <= k; a++){
		LL cur = fact[k-a];
		cur = (cur * fact[n-1-a]) % MOD;
		cur = (cur * invfact[k-2*a]) % MOD;
		ans -= cur;
		ans %= MOD;
	}
	if(ans < 0) ans += MOD;
	cout << ans << endl;
}