AMAZFUL - Amazing Fulia And His Powers


Our well known FULIA has some amazing powers. One day he put 1 candy in a bag and on next day he do some magic, after that due to his amazing powers the number of candies in the bag starts increasing day by day according to the following formula.

C(N) = 2 * C(N - 1) + 3 * C(N - 2)

C(N) denotes number of candies in the bag at Nth day. C(1) = C(2) = 1.

C(N - 1) and C(N - 2) denotes the number of candies on N-1th and N-2th day respectively.

Fulia is weak at maths and can't deal with big numbers, so he want you to write a program to count number of candies C(N) % MOD in the bag at Nth day, where MOD = 1000000007.

Input

First line of input consists of T (number of test cases) then T lines follows, each contains a single integer denoting the day N.

Output

Output the value of C(N) % MOD.

Example

Input:
4
1
2
3
4

Output:
1
1
5
13

Constraints

1 ≤ T ≤ 103

1 ≤ N ≤ 109


hide comments
[Rampage] Blue.Mary: 2016-10-12 08:11:57

This shoule be moved to tutorial section. There already exists large numbers of simple matrix multiplication (to solve recursive relation) problem in SPOJ classical section.


Added by:JUNK
Date:2016-10-12
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU