#include <bits/stdc++.h>

using namespace std;

inline int inv(int n, int p) {
	int i = 1;
	for (int r = n; r > 1; r = p % r)
		i = p / r * long(p - i) % p;
	return i;
}
int f[1111111], g[1111111];
int main()
{
	int n;
	cin >> n;
	int p = 1e9 + 7;
	f[0] = 1, g[n - 1] = 1;
	for (int i = 1; i < n; i++) {
		f[i] = long(i)*f[i - 1] % p;
		g[n - 1 - i] = long(n - 1 - i)*g[n - i] % p;
	}
	int a = 0;
	for (int i = (n + 1) / 2; i < n - 1; i++)
		a = (a + (long(f[i])*f[i - 1]) % p*g[i * 2 - n + 1]) % p;
	cout << (long(n - 1)*f[n - 1] + long(p - a)*inv(f[n - 2], p)) % p << endl;
	return 0;
}
