#include <bits/stdc++.h>
using namespace std;

const int maxn = 1000010, P = 1000000007;
int n, ans, fact[maxn], finv[maxn];

int qp(int x, int y) {
    int z = 1;
    for (; y; y >>= 1, x = 1LL * x * x % P) {
        if (y & 1) z = 1LL * z * x % P;
    }
    return z;
}

int C(int x, int y) {
    if (x < y || y < 0) return 0;
    return 1LL * fact[x] * finv[y] % P * finv[x - y] % P;
}

int main() {
    scanf("%d", &n);
    for (int i = fact[0] = finv[0] = 1; i <= n; i++) {
        fact[i] = 1LL * i * fact[i - 1] % P;
        finv[i] = qp(fact[i], P - 2);
    }
    for (int i = 0; i < n - 1; i++) {
        int t = 1LL * C(n - 2, i) * fact[i] % P;
        t = (t + 1LL * fact[i] * C(n - 2, i - 1)) % P;
        t = (t - 1LL * C(i - 1, i + i - n) * fact[i] % P + P) % P;
        ans = (ans + 1LL * t * fact[n - 1 - i]) % P;
    }
    printf("%d\n", ans);
    return 0;
}