#AGC023C. [AGC023C] Painting Machines

[AGC023C] Painting Machines

Score : 800800 points

Problem Statement

There are NN squares lining up in a row, numbered 11 through NN from left to right. Initially, all squares are white. We also have N1N-1 painting machines, numbered 11 through N1N-1. When operated, Machine ii paints Square ii and i+1i+1 black.

Snuke will operate these machines one by one. The order in which he operates them is represented by a permutation of (1,2,...,N1)(1, 2, ..., N-1), PP, which means that the ii-th operated machine is Machine PiP_i.

Here, the score of a permutation PP is defined as the number of machines that are operated before all the squares are painted black for the first time, when the machines are operated in the order specified by PP. Snuke has not decided what permutation PP to use, but he is interested in the scores of possible permutations. Find the sum of the scores over all possible permutations for him. Since this can be extremely large, compute the sum modulo 109+710^9+7.

Constraints

  • 2N1062 \leq N \leq 10^6

Input

Input is given from Standard Input in the following format:

NN

Output

Print the sum of the scores over all possible permutations, modulo 109+710^9+7.

4
16

There are six possible permutations as PP. Among them, P=(1,3,2)P = (1, 3, 2) and P=(3,1,2)P = (3, 1, 2) have a score of 22, and the others have a score of 33. Thus, the answer is 2×2+3×4=162 \times 2 + 3 \times 4 = 16.

2
1

There is only one possible permutation: P=(1)P = (1), which has a score of 11.

5
84
100000
341429644