public class Euler364 {
    static long modPow(long base, long exp, long mod) {
        long result = 1 % mod;
        base %= mod;
        while (exp > 0) {
            if ((exp & 1) != 0)
                result = (result * base) % mod;
            base = (base * base) % mod;
            exp >>= 1;
        }
        return result;
    }

    static long comfortableArrangementsMod(int n) {
        long mod = 100000007L;
        long[] fact = new long[n + 2];
        fact[0] = 1;
        for (int i = 1; i <= n + 1; ++i) {
            fact[i] = (fact[i - 1] * i) % mod;
        }

        long[] invFact = new long[n + 2];
        invFact[n + 1] = modPow(fact[n + 1], mod - 2, mod);
        for (int i = n + 1; i >= 1; --i) {
            invFact[i - 1] = (invFact[i] * i) % mod;
        }

        long[] pow2 = new long[n + 1];
        pow2[0] = 1;
        for (int i = 1; i <= n; ++i) {
            pow2[i] = (pow2[i - 1] * 2) % mod;
        }

        int[] boundarySum = { 0, 1, 2 };
        int[] boundaryMult = { 1, 2, 1 };

        long total = 0;
        for (int m = 1; m <= n; ++m) {
            long fm = fact[m];
            long fm1 = fact[m - 1];

            for (int t = 0; t < 3; ++t) {
                int s = boundarySum[t];
                int mult = boundaryMult[t];

                int g2 = n - (2 * m - 1 + s);
                if (g2 < 0 || g2 > (m - 1))
                    continue;

                long comb = fm1;
                comb = (comb * invFact[g2]) % mod;
                comb = (comb * invFact[m - 1 - g2]) % mod;

                long term = (mult * comb) % mod;
                term = (term * fm) % mod;
                term = (term * fm1) % mod;
                term = (term * fact[s + g2]) % mod;
                term = (term * pow2[g2]) % mod;

                total = (total + term) % mod;
            }
        }

        return total;
    }

    public static String solve() {
        return String.valueOf(comfortableArrangementsMod(1000000));
    }

    public static void main(String[] args) {
        System.out.println(solve());
    }
}
