Tom and Sequence

3

35 votes
Easy-Medium
Problem

Tom hates mathematical sequences, his friend gave him an integer sequence and asked him to find the nth term of the sequence. As you know Tom is weak at mathematics he asks your help. The sequence is 2, 6, 30, 210,2310 ….. find the nth term of the sequence modulo 1000000007

Input:

The first line of input contains an integer T denoting the number of test cases.

Each line of test case contains an integer n.

Output:

For each test case, output the nth term of the series modulo 1000000007

Constraints:

1<=T<=1000

1<=n<=100000

Sample Input
3
1
2
3
Sample Output
2
6
30
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?