Alice is very fond of Sequences. But she got stuck in a problem. She wants to generate sequences of length N , consisting only of numbers \(1,2,3\) In any sequence each number occurs at least once.
So, she wants your help now to compute this. She has been given N , the length of the sequences she needs to generate. You need to help her, and find out how many such sequences exist. Can you do it ?
The number is so large so you need to compute answer modulo \(1000000007\) .
Input Format :
The first line contains a single integer T denoting the number of test cases. Each of the next T lines contains a single integer N, denoting the parameter of the \(i^{th}\) test.
Output Format :
You have to print the number of sequences of length N that consists of at least one occurence of each of 1, 2 and 3. As the answer can be rather large, print it modulo \(10^9+7\).
Constraints
\( 1 \le T \le 100 \)
\( 1 \le N \le 10^6 \)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor