// Arup Guha
// 1/18/2019
// Solution to Proposed 2019 Mercer Problem: Superstitious Sequences

import java.util.*;

public class superseq_arup {
	
	final public static int MAXBAD = 100;
	final public static long MOD = 1000000007L;
	
	public static long[][] memo;
	public static int n;
	
	public static void main(String[] args) {
		
		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();
		
		// Process each case.
		for (int loop=0; loop<nC; loop++) {
			
			// Set up memo.
			n = stdin.nextInt();
			memo = new long[n+1][100];
			for (int i=0; i<=n; i++) Arrays.fill(memo[i], -1);
			
			// Run it - I want it to be fast enough that we can rerun every time instead of precomp
			System.out.println(go(0, 0));
		}
	}
	
	public static long go(int len, int lasttwo) {
		
		// Done filling it in.
		if (len == n) return 1;		
		
		// Did this before.
		if (memo[len][lasttwo] != -1) return memo[len][lasttwo];
		
		// In this case, we can try all digits.
		if (len == 0) {
			long res = 0;
			for (int d=0; d<10; d++)
				res = (res + go(len+1, d))%MOD;
			return memo[len][lasttwo] = res;
		}
		
		// In this case, we can try all but the previous digit.
		if (len == 1) {
			long res = 0;
			for (int d=0; d<10; d++) {
				if (d == lasttwo) continue;
				res = (res + go(len+1, 10*lasttwo+d))%MOD;
			}
			return memo[len][lasttwo] = res;
		}
		
		// Extract these.
		int twoback = lasttwo/10;
		int oneback = lasttwo%10;
		long res = 0;
		
		// Previously going up, we must go back down.
		if (twoback < oneback) {
			for (int d=0; d<oneback; d++) {
				
				// Only one other restriction, this number can't be twoback.
				if (d == twoback) continue;
				res = (res + go(len+1, 10*oneback+d))%MOD;
			}
		}
		
		// Previously going down, we must go back up.
		else {
			for (int d=oneback+1; d<10; d++) {
				
				// Only one other restriction, this number can't be twoback.
				if (d == twoback) continue;
				res = (res + go(len+1, 10*oneback+d))%MOD;
			}
		}
		
		// Store and return.
		return memo[len][lasttwo] = res;
	}
}