#include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <istream>

#include <map>
#include <math.h>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

namespace asl
{
    
    void asl_assert(bool condition)
    {

    }
} 

#include <experimental/optional>

namespace asl
{
    
    const int m1000000007 = 1000000007;
    
    int MOD = m1000000007;

    void set_mod(int mod)
    {
        MOD = mod;
    }

    class Mint
    {
    public:
        int val;

        Mint(long long v = 0)
        {
            if (v >= 0)
            {
                if (v < MOD)
                    val = v;
                else
                    val = v % MOD;
            }
            else
            {
                if (v >= -MOD)
                {
                    val = v + MOD;
                }
                else
                {
                    v %= MOD;
                    if (v < 0)
                        v += MOD;
                    val = v;
                }
            }
        }

        Mint &operator+=(const Mint &other)
        {
            val += other.val;
            if (val >= MOD)
                val -= MOD;
            return *this;
        }

        Mint &operator-=(const Mint &other)
        {
            val -= other.val;
            if (val < 0)
                val += MOD;
            return *this;
        }

        static unsigned fast_mod(uint64_t x, unsigned m = MOD)
        {
#if !defined(_WIN32) || defined(_WIN64)
            return x % m;
#endif
            
            unsigned x_high = x >> 32, x_low = (unsigned)x;
            unsigned quot, rem;
            asm("divl %4\n"
                : "=a"(quot), "=d"(rem)
                : "d"(x_high), "a"(x_low), "r"(m));
            return rem;
        }

        Mint &operator*=(const Mint &other)
        {
            val = fast_mod((uint64_t)val * other.val);
            return *this;
        }

        friend Mint operator-(const Mint &a, const Mint &b) { return Mint(a) -= b; }
        friend Mint operator*(const Mint &a, const Mint &b) { return Mint(a) *= b; }
        
        friend std::ostream &operator<<(std::ostream &stream, const Mint &m)
        {
            return stream << m.val;
        }

    };
 
    std::vector<Mint> inv = {0, 1}, factorial = {1, 1}, inv_factorial = {1, 1};

    void prepare_factorials(int maximum)
    {
        factorial.resize(maximum + 1);
        inv.resize(maximum + 1);
        inv_factorial.resize(maximum + 1);

        for (int p = 2; p * p <= MOD; p++)
            asl_assert(MOD % p != 0);

        for (int i = 2; i <= maximum; ++i)
        {
            factorial[i] = i * factorial[i - 1];
            inv[i] = inv[MOD % i] * (MOD - MOD / i);
            inv_factorial[i] = inv[i] * inv_factorial[i - 1];
        }
    }

    Mint choose(long long n, long long r)
    {
        asl_assert(n < inv_factorial.size());
        asl_assert(n < factorial.size());

        if (r < 0 || r > n)
            return 0;
        return factorial[n] * inv_factorial[r] * inv_factorial[n - r];
    }

} 

#include <random>

#define endl '\n'

using namespace std;
using namespace asl;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    set_mod(m1000000007);

    int n;
    cin >> n;

    if (n == 2)
    {
        cout << 1 << endl;
        return 0;
    }

    prepare_factorials(n + 1);

    Mint ans, prev;

    for (int k = 2; k <= n - 1; ++k)
    {
        Mint cur = choose(k - 1, n - k - 1) * factorial[k] * factorial[n - 1 - k];
        ans += (cur - prev) * k;
        prev = cur;
    }

    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 15056