Scheme? - Too loudly said. Just a new idea. Now Chef is expanding his business. He wants…
- User
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
Assistant
We need to count number of sequences of length N over 4 symbols (dishes) such that consecutive days are different, and also first and last are different. N >= 2.
Number of sequences of length N over k=4 colors with no two adjacent equal (proper colorings of a path of length N vertices, where vertices correspond to days, edges between consecutive days) is: k * (k-1)^(N-1). Because choose first (4 choices), then each next can be any of the other 3 (since not equal to previous). That yields total proper sequences