Competitions

# Reduce to one

Consider a list of integers L. Initially L contains the integers 1 through n, each of them exactly once (but it may contain multiple copies of some integers later). The order of elements in L is not important. You should perform the following operation n1 times:

• Choose two elements of the list, let's denote them by x and y. These two elements may be equal.
• Erase the chosen elements from L.
• Append the number x + y + x * y to L.

At the end, L contains exactly one integer. Find the maximum possible value of this integer. Since the answer may be large, compute it modulo 109 + 7.

#### Input

The first line contains the number of test cases t. Each of the next t lines contains a single integer n (1n106).

#### Output

For each test case, print a single line containing one integer - the maximum possible value of the final number in the list modulo 109 + 7.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3
1
2
4

Output example #1
1
5
119