The New Scheme

All submissions for this problem are available.
Scheme?  Too loudly said. Just a new idea. Now Chef is expanding his business. He wants to make some new restaurants in the big city of Lviv. To make his business competitive he should interest customers. Now he knows how. But don't tell anyone  it is a secret plan. Chef knows four national Ukrainian dishes  salo, borsch, varenyky and galushky. It is too few, of course, but enough for the beginning. Every day in his restaurant will be a dish of the day among these four ones. And dishes of the consecutive days must be different. To make the scheme more refined the dish of the first day and the dish of the last day must be different too. Now he wants his assistant to make schedule for some period. Chef suspects that there is more than one possible schedule. Hence he wants his assistant to prepare all possible plans so that he can choose the best one among them. He asks you for help. At first tell him how many such schedules exist. Since the answer can be large output it modulo 10^{9} + 7, that is, you need to output the remainder of division of the actual answer by 10^{9} + 7.
Input
The first line of the input contains an integer T, the number of test cases. Each of the following T lines contains a single integer N denoting the number of days for which the schedule should be made.
Output
For each test case output a single integer in a separate line, the answer for the corresponding test case.
Constraints
1 ≤ T ≤ 100
2 ≤ N ≤ 10^{9}
Example
Input: 3 2 3 5 Output: 12 24 240
Explanation
Case 1. For N = 2 days we have the following 12 schedules:
First day  Second day 
salo  borsch 
salo  varenyky 
salo  galushky 
borsch  salo 
borsch  varenyky 
borsch  galushky 
varenyky  salo 
varenyky  borsch 
varenyky  galushky 
galushky  salo 
galushky  borsch 
galushky  varenyky 
Case 2. For N = 3 we have the following 24 schedules:
First day  Second day  Third day 
salo  borsch  varenyky 
salo  borsch  galushky 
salo  varenyky  borsch 
salo  varenyky  galushky 
salo  galushky  borsch 
salo  galushky  varenyky 
borsch  salo  varenyky 
borsch  salo  galushky 
borsch  varenyky  salo 
borsch  varenyky  galushky 
borsch  galushky  salo 
borsch  galushky  varenyky 
varenyky  salo  borsch 
varenyky  salo  galushky 
varenyky  borsch  salo 
varenyky  borsch  galushky 
varenyky  galushky  salo 
varenyky  galushky  borsch 
galushky  salo  borsch 
galushky  salo  varenyky 
galushky  borsch  salo 
galushky  borsch  varenyky 
galushky  varenyky  salo 
galushky  varenyky  borsch 
Case 3. Don't be afraid. This time we will not provide you with a table of 240 schedules. The only thing we want to mention here is that apart from the previous two cases schedules for other values of N can have equal dishes (and even must have for N > 4). For example the schedule (salo, borsch, salo, borsch) is a correct schedule for N = 4 while the schedule (varenyky, salo, galushky, verynky, salo) is a correct schedule for N = 5.
Author:  witalij_hq 
Tester:  anton_lunyov 
Editorial  http://discuss.codechef.com/problems/NEWSCH 
Tags  matrixexpo, oct12, simple, witalij_hq 
Date Added:  10082012 
Time Limit:  0.825301 sec 
Source Limit:  50000 Bytes 
Languages:  C, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions