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
maxn=10000
mod=10**9+9
d=[]
for i in xrange(0,10):
	d.append([0]*(maxn+1))
	d[i][0]=0
	d[i][1]=1
for z in xrange(2,(maxn+1)):
	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 _ in xrange(input()):
	n=input()
	print sum([d[i][n] for i in xrange(0,10)])%mod