import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons;
import std.math, std.numeric;

immutable long mod = 10L^^9 + 7;

void main() {
    int n; scan(n);

    auto fact = new long[](n + 1);
    auto rfact = new long[](n + 1);
    fact[0] = 1;
    foreach (i ; 1 .. n + 1) {
        fact[i] = (fact[i-1] * i) % mod;
    }
    rfact[n] = powmod(fact[n], mod - 2, mod);
    foreach_reverse (i ; 0 .. n) {
        rfact[i] = (rfact[i+1] * (i+1)) % mod;
    }
    debug {
        writeln(fact);
        writeln(rfact);
    }
    long binom(int n, int k) {
        return fact[n] * rfact[k] % mod * rfact[n-k] % mod;
    }

    long ans;
    long pre;

    foreach (k ; 0 .. n) {
        int b = n - 2 - (k - 1);
        if (b < 0 || b > k - 1) continue;
        long v = binom(k - 1, b) * fact[k] % mod * fact[n - 1 - k] % mod;
        debug {
            writeln(k, " ", v);
        }
        ans += k * (v - pre + mod) % mod;
        ans %= mod;
        pre = v;
    }

    writeln(ans);
}



long powmod(long x, long y, long mod) {
    return y > 0 ? powmod(x, y>>1, mod)^^2 % mod * x^^(y&1) % mod : 1L;
}






void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}
