KOPC12B - K12-Combinations

no tags 

Given n find the value of ((nC1)2+2*(nC2)2+3*(nC3)2+4*(nC4)2+ ... +n*(nCn)2)% MOD, where MOD=10^9+7.

Note: nCr is the number of ways of choosing r items from n items.

Input

The first line of input file contains T which denotes number of test cases. Each of the following line contains an integer n. T<=1000 and n<=10^6.

Output

The output must contain T lines each line corresponding to a testcase.

Example

Input:
2
1
2

Output:
1
6

hide comments
mandu_ism: 2014-10-24 19:45:30

Beware of unnecessary precomputations! cost me a lot of TLEs.

vikas sharma: 2013-06-05 09:25:47

Finally AC.... was doing a silly mistake...:)

[Lakshman]: 2013-05-14 18:30:11

Good one...Finally AC....

Ouditchya Sinha: 2013-05-12 03:41:15

Finally AC! Awesome problem. High School Maths... :)

Arpit Mittal: 2013-04-20 20:25:30

strangely getting nzec error

varshini: 2012-02-07 18:43:14

getting TLE..!!!


Added by:Radhakrishnan Venkataramani
Date:2012-01-31
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64