题目描述
A permutation of length N is an array of $N integers A = [A_{1}, A_{2}, \dots, A_{N}]$ such that every integer from 1 to N appears in it exactly once.
We define a function over a permutation as follows:
$F(A) = (A_{1} * A_{2}) + (A_{2} * A_{3}) + \cdots + (A_{N-2} * A_{N-1}) + (A_{N-1}*A_{N})$
You are given an integer N. What is the expected value of the function F over all possible permutations of length N?
The expected value of the function can be represented as a fraction of the form $\frac{P}{Q}.$ You are required to print $P \cdot Q^{-1} \pmod{1$ \, 000 \, 000 \, 007}.
------ Input Format ------
- The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
- The first and only line of each test case contains a single integer N.
------ Output Format ------
For each test case, output on a single line the expected value of the function modulo 1 \, 000 \, 000 \, 007.
------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$2 ≤ N ≤ 10^{9}$
----- Sample Input 1 ------
2
2
3
----- Sample Output 1 ------
2
333333343
----- explanation 1 ------
- Test Case $1$: There are $2$ possible permutations: $A = \{1, 2\}$ with $F(A) = 2$ and $A = \{2, 1\}$ with $F(A) = 2$. Hence the expected value of the function is $F(A) = \frac{1}{2} * 2 + \frac{1}{2} * 2 = 2$.
- Test Case $2$: There are $6$ possible permutations, with the value of function as $\{5, 5, 8, 8, 9, 9 \}$. Hence the expected value of the function is $F(A) = \frac{5+5+8+8+9+9}{6} = \frac{22}{3}$. The required output will be $333333343$, since $333333343 \cdot 3 \equiv 22 \pmod {1 \, 000 \, 000 \, 007}$.
输入格式
见题面
输出格式
见题面