#include <iostream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <limits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#include <cmath>
#include <complex>

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

const int INFL = (int)1e9;
const ll INFLL = (ll)1e18;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)n; i >= 1; i--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(i, vector.size()) { cout << vector[i] << " "; } cout << endl;
#define printmx(matrix) Loop(i, matrix.size()) { Loop(j, matrix[i].size()) { cout << matrix[i][j] << " "; } cout << endl; }
#define rnd(d) (ll)((double)(d) + (d >= 0 ? 0.5 : -0.5))
#define floorsqrt(x) ((ll)sqrt((double)x) + ((ll)sqrt((double)x) * (ll)sqrt((double)x) <= (ll)(x) ? 0 : -1))
#define ceilsqrt(x) ((ll)sqrt((double)x) + ((ll)x <= (ll)sqrt((double)x) * (ll)sqrt((double)x) ? 0 : 1))
#define ceildiv(a, b) ((ll)(a) / (ll)(b) + ((ll)(a) % (ll)(b) == 0 ? 0 : 1))
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)

/*******************************************************/

namespace mod_op {

	const ll MOD = (ll)1e9 + 7;

	class Extended_Euclid {
	private:
		ll m, n;
		vvll mx_multiply(vvll mx1, vvll mx2) {
			vvll ret(mx1.size(), vll(mx2[0].size(), 0));
			Loop(i, mx1.size()) {
				Loop(j, mx1[0].size()) {
					Loop(k, mx2[0].size()) {
						ret[i][j] += mx1[i][k] * mx2[k][j];
					}
				}
			}
			return ret;
		}
	public:
		// solve x, y s.t. mx + ny = gcd(m,n)
		ll x, y, gcd;
		Extended_Euclid(ll M, ll N) {
			m = M;
			n = N;
			vll r(100), k(100);
			bool swapflag = false, m_negflag = false, n_negflag = false;
			if (m < n) { swap(m, n); swapflag = true; }
			if (m < 0) { m *= -1; m_negflag = true; }
			if (n < 0) { n *= -1; n_negflag = true; }
			r[0] = m;
			r[1] = n;
			int h = 1;
			while (1) {
				k[h - 1] = r[h - 1] / r[h];
				r[h + 1] = r[h - 1] % r[h];
				if (r[h + 1] == 0) break;
				h++;
			}
			gcd = r[h];
			vvll mx1 = { { 0, 1 },{ 1, (-1) * k[h - 1] } };
			Loopr(i, h - 1) {
				vvll mx2 = { { 0, 1 },{ 1, (-1) * k[i] } };
				mx1 = mx_multiply(mx1, mx2);
			}
			x = mx1[0][0];
			y = mx1[0][1];
			if (n_negflag) { n *= -1; y *= -1; }
			if (m_negflag) { m *= -1; x *= -1; }
			if (swapflag) { swap(m, n); swap(x, y); }
		}
	};

	class modll {
	private:
		ll val;
		inline ll modify(ll x) { ll ret = x % MOD; if (ret < 0) ret += MOD; return ret; }
		inline ll inv(ll x) { if (x == 0) return 1 / x; Extended_Euclid ee(x, -MOD); return modify(ee.x); }
	public:
		modll(ll init = 0) { val = modify(init); return; }
		modll(const modll& another) { val = another.val; return; }
		inline modll& operator=(const modll &another) { val = another.val; return *this; }
		inline modll operator+(const modll &x) { return (val + x.val) % MOD; }
		inline modll operator-(const modll &x) { return (val - x.val) % MOD; }
		inline modll operator*(const modll &x) { return (val * x.val) % MOD; }
		inline modll operator/(const modll &x) { return (val * inv(x.val)) % MOD; }
		inline modll& operator+=(const modll &x) { val = (val + x.val) % MOD; return *this; }
		inline modll& operator-=(const modll &x) { val = (val - x.val) % MOD; return *this; }
		inline modll& operator*=(const modll &x) { val = (val * x.val) % MOD; return *this; }
		inline modll& operator/=(const modll &x) { val = (val * inv(x.val)) % MOD; return *this; }
		friend inline istream& operator >> (istream &is, modll& x) { is >> x.val; return is; }
		friend inline ostream& operator << (ostream &os, modll& x) { os << x.val; return os; }
		ll get_val() { return val; }
	};

	modll pow(modll n, ll p) {
		modll ret;
		if (p == 0) ret = 1;
		else if (p == 1) ret = n;
		else {
			ret = pow(n, p / 2);
			ret *= ret;
			if (p % 2 == 1) ret *= n;
		}
		return ret;
	}

	vector<modll> facts;

	inline void make_facts(int n) {
		if (facts.empty()) facts.push_back(modll(1));
		for (int i = facts.size(); i <= n; ++i) facts.push_back(modll(facts.back() * (ll)i));
		return;
	}

	vector<modll> ifacts;
	vector<modll> invs;

	inline void make_invs(int n) {
		if (invs.empty()) {
			invs.push_back(modll(0));
			invs.push_back(modll(1));
		}
		for (int i = invs.size(); i <= n; ++i) {
			invs.push_back(invs[(int)MOD % i] * ((int)MOD - (int)MOD / i));
		}
		return;
	}

	inline void make_ifacts(int n) {
		make_invs(n);
		if (ifacts.empty()) ifacts.push_back(modll(1));
		for (int i = ifacts.size(); i <= n; ++i) ifacts.push_back(modll(ifacts.back() * invs[i]));
		return;
	}

	//nCr
	modll combination(ll n, ll r, bool make_ifacts_flag = false) {
		if (n < r || n < 0) return 0;
		modll ret;
		make_facts((int)n);
		if (make_ifacts_flag) {
			make_ifacts((int)n);
			ret = facts[(unsigned)n] * ifacts[(unsigned)r] * ifacts[(unsigned)(n - r)];
		}
		else {
			ret = facts[(unsigned)n] / (facts[(unsigned)r] * facts[(unsigned)(n - r)]);
		}
		return ret;
	}

	modll get_fact(ll n) {
		make_facts((int)n);
		return facts[(int)n];
	}

	vector<vector<modll>> Stirling_nums2;
	vector<vector<modll>> Stirling_nums2_sum;

	void make_Stirling_nums2(int n) {
		for (int i = Stirling_nums2.size(); i <= n; ++i) {
			Stirling_nums2.push_back(vector<modll>(i + 1));
			Stirling_nums2_sum.push_back(vector<modll>(i + 1, 0));
			Loop(j, i + 1) {
				if (j == 0) Stirling_nums2[i][j] = 0;
				else if (j == 1) Stirling_nums2[i][j] = 1;
				else if (j == i) Stirling_nums2[i][j] = 1;
				else Stirling_nums2[i][j] = Stirling_nums2[i - 1][j - 1] + Stirling_nums2[i - 1][j] * modll(j);
				if (j > 0) Stirling_nums2_sum[i][j] = Stirling_nums2_sum[i][j - 1] + Stirling_nums2[i][j];
			}
		}
	}

	modll get_Stirling_num2(ll n, ll r) {
		if (n < r) return 0;
		else {
			make_Stirling_nums2((int)n);
			return Stirling_nums2[(int)n][(int)r];
		}
	}

	modll get_Stirling_num2_sum(ll n, ll r) {
		if (n < r) return 0;
		else {
			make_Stirling_nums2((int)n);
			return Stirling_nums2_sum[(int)n][(int)r];
		}
	}

	vector<vector<modll>> partition_nums;
	vector<vector<modll>> partition_nums_sum;

	void make_partition_nums(int n) {
		for (int i = partition_nums.size(); i <= n; ++i) {
			partition_nums.push_back(vector<modll>(i + 1));
			partition_nums_sum.push_back(vector<modll>(i + 1, 0));
			Loop(j, i + 1) {
				if (j == 0) partition_nums[i][j] = 0;
				else if (j == 1) partition_nums[i][j] = 1;
				else if (j == i) partition_nums[i][j] = 1;
				else partition_nums[i][j] = partition_nums[i - 1][j - 1] + (i >= j * 2 ? partition_nums[i - j][j] : 0);
				if (j > 0) partition_nums_sum[i][j] = partition_nums_sum[i][j - 1] + partition_nums[i][j];
			}
		}
	}
	modll get_partition_num(ll n, ll r) {
		if (n < r) return 0;
		else {
			make_partition_nums((int)n);
			return partition_nums[(int)n][(int)r];
		}
	}

	modll get_partition_num_sum(ll n, ll r) {
		if (n < r) return 0;
		else {
			make_partition_nums((int)n);
			return partition_nums_sum[(int)n][(int)r];
		}
	}

	//a^x=b, if x does not exist, return -1
	ll disc_log(modll a, modll b) {
		ll ret = -1;
		ll m = ceilsqrt(MOD);
		unordered_map<ll, ll> mp;
		modll x = 1;
		Loop(i, m) {
			mp[x.get_val()] = i;
			x *= a;
		}
		x = modll(1) / pow(a, m);
		modll k = b;
		Loop(i, m) {
			if (mp.find(k.get_val()) == mp.end()) k *= x;
			ret = i * m + mp[k.get_val()];
		}
		return ret;
	}
}

using namespace mod_op;
typedef vector<modll> vmodll;
typedef vector<vector<modll>> vvmodll;

// the number of methods of dividing n factors into r groups
modll grouping(ll n, ll r, bool distinct_n, bool distinct_r, bool enable_empty_r) {
	int mode = (distinct_n ? 0b100 : 0) + (distinct_r ? 0b010 : 0) + (enable_empty_r ? 0b001 : 0);
	if (n <= 0 || r <= 0) return 0;
	switch (mode) {
	case 0b000:
		return get_partition_num(n, r);
	case 0b001:
		return get_partition_num_sum(n, r);
	case 0b010:
		return combination(n - 1, r - 1);
	case 0b011:
		return combination(n + r - 1, r - 1);
	case 0b100:
		return get_Stirling_num2(n, r);
	case 0b101:
		return get_Stirling_num2_sum(n, r);
	case 0b110:
		return get_Stirling_num2(n, r) * get_fact(r);
	case 0b111:
		return pow(modll(r), n);
	default:
		return 0;
	}
}

int main() {
	ll n; cin >> n;
	modll ans = 0;
	if (n == 2) {
		cout << 1 << endl;
	}
	else {
		vector<modll> buf(n, 0);
		Loop1(k, n - 1) {
			buf[k] = combination(k - 1, n - k - 1, true) * get_fact(k) * get_fact(n - 1 - k);
		}
		Loop1(k, n - 1) {
			ans += (buf[k] - buf[k - 1]) * k;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 35944