#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,a,n) for (int i=a;i<(int)n;i++) #define per(i,a,n) for (int i=n-1;i>=a;i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) #define ACCU accumulate #define TWO(x) (1<<(x)) #define TWOL(x) (1ll<<(x)) #define clr(a) memset(a,0,sizeof(a)) typedef vector VI; typedef vector VS; typedef long long ll; typedef long double LD; typedef pair PII; typedef vector VPII; const int inf=0x20202020; const ll mod=1000000007; const double eps=1e-9; const double pi=3.1415926535897932384626; ll powmod(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} // head ll f[1010000],g[1010000],dp[2600]; class PermutationCounts { public: int countPermutations(int N, vector pos) { f[0]=1; rep(i,1,1000001) f[i]=f[i-1]*i%mod; rep(i,0,1000001) g[i]=powmod(f[i],mod-2); sort(all(pos)); pos.insert(pos.begin(),0); pos.pb(N); int m=SZ(pos)-1; dp[0]=1; rep(i,1,m+1) { dp[i]=0; rep(j,0,i) dp[i]=(dp[i]-dp[j]*g[pos[i]-pos[j]])%mod; } ll ans=dp[m]*f[N]%mod; if (m%2) ans*=-1; if (ans<0) ans+=mod; return ans; } }; int main() { int N; cin >> N; if (N <= 2) { cout << 0 << endl; return 0; } PermutationCounts pc; vector a, b; for (int i = 0; i + 1 < N; i++) if (i % 2 == 0) a.push_back(i + 1); else b.push_back(i + 1); cout << (pc.countPermutations(N, a) + pc.countPermutations(N, b)) % mod << endl; }