There is a huge 2 x N board, six types of tiles are available, and each of them is infinitely many, you have to find the number of ways you can fill the board using the tiles. Two board configurations are different if at least in one cell, their colors differ. The tiles are given below:
You cannot rotate or flip any tile. And no cell in the board should be empty. The tiles shouldn't overlap.
For example, a 2 x 3 board can be colored by 5 ways, they are:
Input
Input starts with an integer T (≤ 10000), denoting the number of test cases.
Each case starts with a line containing an integer N (1 ≤ N ≤ 109).
Output
For each case, print the case number and the number of ways the board can be colored. The number may be large, so, output the number modulo 10007 (104 + 7).
Sample
Sample Input | Sample Output |
---|---|
5 3 10 20 100 87 | Case 1: 5 Case 2: 1255 Case 3: 6239 Case 4: 6542 Case 5: 5502 |