You are given N squares in a row, initially white. There are N-1 painting machines, each painting two adjacent squares black. Snuke operates the machines in a specific order, represented by a permutation P. The score of a permutation is the number of machines operated before all squares are black. Find the sum of scores over all permutations, modulo 10^9+7. Constraints: 2 ≤ N ≤ 10^6. Input: N. Output: Sum of scores over all permutations. Example: Input 4, Output 16. There are six possible permutations. Example: Input 2, Output 1. Only one possible permutation. Example: Input 5, Output 84. Example: Input 100000, Output 341429644.

# Buggy version:
n = int(input())
fn,fk,mod = [1]*n,[1]*n,10**9+7
for i in range(n-1): fn[i+1] = (fn[i]*(i+2))%mod
def power(n,k):
	if k==1: return n
	elif k%2==0: return power((n**2)%mod,k//2)
	else: return (n*power(n,k-1))%mod
def comb(n,k):
	if n<k or k<0: return 0
	elif k==0 or n==k: return 1
	else: return (((fn[n-1]*fk[n-k-1])%mod)*fk[k-1])%mod
fk[-1] = power(fn[-1],mod-2)
for i in range(2,n+1): fk[-i] = (fk[-i+1]*(n+2-i))%mod
fn.append(1)
ans = f[n-2]
for i in range(2,n):
	ans = (ans-comb(i-1,n-i-1)*fn[i-1]*fn[n-i-2])%mod
print(ans)

# Fixed version:
n = int(input())
fn,fk,mod = [1]*n,[1]*n,10**9+7
for i in range(n-1): fn[i+1] = (fn[i]*(i+2))%mod
def power(n,k):
	if k==1: return n
	elif k%2==0: return power((n**2)%mod,k//2)
	else: return (n*power(n,k-1))%mod
def comb(n,k):
	if n<k or k<0: return 0
	elif k==0 or n==k: return 1
	else: return (((fn[n-1]*fk[n-k-1])%mod)*fk[k-1])%mod
fk[-1] = power(fn[-1],mod-2)
for i in range(2,n+1): fk[-i] = (fk[-i+1]*(n+2-i))%mod
fn.append(1)
ans = fn[n-2]*(n-1)
for i in range(n-2,(n-1)//2,-1):
	ans = (ans-comb(i-1,n-i-1)*fn[i-1]*fn[n-i-2])%mod
print(ans)

# Buggy version:
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

MOD = 10**9 + 7

N = read()

NN = N + 1
fact = [1] * NN
for i in range(1, NN):
  fact[i] = (fact[i-1] * i) % MOD

def inv(n):
  return pow(n, MOD-2, MOD)

def comb(n, k):
  return fact[n] * inv(fact[n-k]) % MOD * inv(fact[k]) % MOD

S = [0] * N
for k in range((N+1) // 2, N):
  c = comb(k-1, N-1-k)
  S[k] = c * fact[k] % MOD

# print(S, file=stderr)

ans = 0
for k in range((N+1) // 2, N):
  ans = (ans + k * (S[k] - S[k-1] * (N - k)) % MOD) % MOD
print(ans)


# Fixed version:
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect
 
def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]
 
MOD = 10**9 + 7
 
N = read()
 
NN = N + 1
fact = [1] * NN
for i in range(1, NN):
  fact[i] = (fact[i-1] * i) % MOD
 
def inv(n):
  return pow(n, MOD-2, MOD)
 
invfact = [0] * NN
invfact[-1] = inv(fact[-1])
for i in range(NN-2, -1, -1):
  invfact[i] = invfact[i+1] * (i+1) % MOD
 
def comb(n, k):
  return fact[n] * invfact[n-k] % MOD * invfact[k] % MOD
 
S = [0] * N
for k in range((N+1) // 2, N):
  S[k] = comb(k-1, N-1-k) * fact[k] % MOD * fact[N-1-k] % MOD
 
ans = 0
for k in range((N+1) // 2, N):
  ans = (ans + k * (S[k] - S[k-1]) % MOD) % MOD
print(ans)

# Buggy version:
n = int(input())
p = 10**9 + 7

def fact(n):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

def invfact(n, f, p):
    m = pow(f[n], p-2, p)
    yield m
    for i in range(n, 0, -1):
        m = m * i % p
        yield m

ans = 0
m = n - 1
f = list(fact(m))
rf = list(invfact(m, f, p))
rf.reverse()
perm = 0

for k in range((n+1)//2, n):
    perm_ = f[k-1] * rf[2*k-n-2] %p * f[k] % p
    ans += (perm_ - perm) %p * k % p
    ans %= p
    perm = perm_

print(ans)

# Fixed version:
n = int(input())
p = 10**9 + 7

def fact(n):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

def invfact(n, f, p):
    m = pow(f[n], p-2, p)
    yield m
    for i in range(n, 0, -1):
        m = m * i % p
        yield m

ans = 0
m = n - 1
f = list(fact(m))
rf = list(invfact(m, f, p))
rf.reverse()
perm = 0

for k in range((n+1)//2, n):
    perm_ = f[k-1] * rf[2*k-n] %p * f[k] % p
    ans += (perm_ - perm) %p * k % p
    ans %= p
    perm = perm_

print(ans)

# Buggy version:
n = int(input())
p = 10**9 + 7

def fact(n):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

ans = 0
m = n - 1
f = list(fact(m))
perm = 0

for k in range((n+1)//2, n):
    b = m - k
    a = (m - 1) - (2 * b)
    perm_ = f[a+b] * pow(f[a], p-2, p) %p * pow(f[b], p-2, p) %p * f[k] % p * f[m-k] % p
    ans += (perm_ - perm) %p * k % p
    perm = perm + perm_ %p

print(ans)

# Fixed version:
n = int(input())
p = 10**9 + 7

def fact(n):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

def invfact(n, f, p):
    m = pow(f[n], p-2, p)
    yield m
    for i in range(n, 0, -1):
        m = m * i % p
        yield m

ans = 0
m = n - 1
f = list(fact(m))
rf = list(invfact(m, f, p))
rf.reverse()
perm = 0

for k in range((n+1)//2, n):
    b = m - k
    a = (m - 1) - (2 * b)
    perm_ = f[a+b] * rf[a] %p * f[k] % p
    ans += (perm_ - perm) %p * k % p
    ans %= p
    perm = perm_

print(ans)