Problem: DJ Boy is a new generation child he has never seen numeric keypad of mobile. So one day when Prem showed him his mobile, DJ boy started laughing on him. Prem being smart gave him a problem to solve with some condition. Your task is to help DJ boy to solve this problem:

Given a number N, DJ boy has to tell how many numbers of length N are possible.

Conditions:

1)He can only press digit that are adjacent i.e. to the left, right, up or bottom to current digit.

2)He may press the same key again i.e. numbers like 000 & 080 are possible for length 3.

3)He cannot press * and # keys.

Constraints:

1 ≤ t ≤ 100

0 ≤ N ≤ 10000

MOD: 10^9 + 9

Input:

First line contains T,the number of test cases.
Next t lines contain a number N.

Output:

Print the required number modulo MOD.

SAMPLE INPUT
2
1
2

SAMPLE OUTPUT
10
36

Solution (in PYTHON):

Solution:
import sys
data = []
for line in sys.stdin:
    data.append(line)
T = int(data[0]) #read in number test cases to loop over it

#preprocess all possiblities so that later we just have to add sums at their index
maxN = 10000
d = []
for a in range(0,10):
    d.append([0]*(maxN+1))
    d[a][0] = 0
    d[a][1] = 1
for z in range(2,len(d[0])):
    d[0][z] = d[0][z-1] + d[8][z-1]
    d[1][z] = d[1][z-1] + d[2][z-1] + d[4][z-1]
    d[2][z] = d[2][z-1] + d[1][z-1] + d[5][z-1] + d[3][z-1]
    d[3][z] = d[3][z-1] + d[2][z-1] + d[6][z-1]
    d[4][z] = d[4][z-1] + d[1][z-1] + d[5][z-1] + d[7][z-1]
    d[5][z] = d[5][z-1] + d[2][z-1] + d[4][z-1] + d[6][z-1] + d[8][z-1]
    d[6][z] = d[6][z-1] + d[3][z-1] + d[5][z-1] + d[9][z-1]
    d[7][z] = d[7][z-1] + d[4][z-1] + d[8][z-1]
    d[8][z] = d[8][z-1] + d[5][z-1] + d[7][z-1] + d[9][z-1] + d[0][z-1]
    d[9][z] = d[9][z-1] + d[6][z-1] + d[8][z-1]
for t in range(0,T):
	N = int(data[t+1])
	possibility = 0
	for a in range(0,10):
	    possibility = possibility + d[a][N]
	print possibility % (10**9 + 9)