1. He always presses the button which has a digit written on it, i.e., he never presses the ‘*’ and ‘#’ button.
2. Once he presses a button, the next button he presses should either be the same button or the button which is adjacent to the previous button.
3. In starting he can press any button except ‘*’ and ‘#’.

Mike is too little to solve this problem. Help Mike to solve this problem. As the answer can be large, so find the answer modulo 10^9 + 7.
The first line of input contains a single integer 'T', representing the number of test cases or queries to be run.
Then the 'T' test cases follow.
The first and only line of each test case contains a positive integer N, which represents the number of buttons to press.
Output Format :
For each test case, print the number of numbers that can be generated after pressing exactly the N buttons on the keypad.
The output of each test case is printed in a separate line.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 5 * 10^4
Time Limit: 1 sec
2
1
5
10
2062
In the 1st test case, Mike can generate the following numbers {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}.
In the 2nd test case, some of the numbers that Mike can generate are {12365, 11111, 74747, 08521,....}.
2
2
3
36
138
Think of a recursive approach to solve the problem.
We will recursively find the different numbers we can generate after pressing N buttons on the keypad.
For simplicity, we will define the keypad with a 2D matrix.
keypad[][] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {-1, 0, -1}}
Below is the detailed algorithm:
Make a recursive function ‘generateNumbersHelper’ which will return the number of numbers we can generate after pressing ‘N’ buttons on the ‘KEYPAD’.
O(5^N), Where N is the number of buttons to press.
At each step, we have at most 5 choices to choose the button to press and we have to press exactly N buttons. Thus, the final time complexity is O(5^N).
O(N), Where N is the number of buttons to press.
O(N) recursion stack space will be used.