AtCoder Grand Contest 023
C
Painting Machines
AtCoder
⌀ 2568
原题
← BD →
翻译中…

Problem Statement

翻译中…

There are $N$ squares lining up in a row, numbered $1$ through $N$ from left to right. Initially, all squares are white. We also have $N-1$ painting machines, numbered $1$ through $N-1$. When operated, Machine $i$ paints Square $i$ and $i+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, ..., N-1)$, $P$, which means that the $i$-th operated machine is Machine $P_i$.

翻译中…

Here, the score of a permutation $P$ 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 $P$. Snuke has not decided what permutation $P$ 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 $10^9+7$.

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 10^6$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

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

翻译中…

样例

Input #1
4
Output #1
16
There are six possible permutations as $P$. Among them, $P = (1, 3, 2)$ and $P = (3, 1, 2)$ have a score of $2$, and the others have a score of $3$. Thus, the answer is $2 \times 2 + 3 \times 4 = 16$.
Input #2
2
Output #2
1
There is only one possible permutation: $P = (1)$, which has a score of $1$.
Input #3
5
Output #3
84
Input #4
100000
Output #4
341429644
题目信息
题号
agc023_c
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。