#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll a[30][30],b[30][30],c[30][30];

void init(){
	int i,j;
	for(i=0; i<21; ++i){
		for(j=0; j<21; ++j){
			a[i][j] = (i==j);
		}
	}
	for(i=0; i<21; ++i){
		for(j=0; j<21; ++j){
			b[i][j] = 0ll;
		}
	}
	for(i=0; i<10; ++i){
		b[i][i^1] += 1ll;
	}
	for(i=0; i<8; i+=2){
		for(j=i+3; j<10; j+=2){
			b[i][j] += 1ll;
		}
		b[i][10] += 1ll;
	}
	for(i=8; i<20; i+=2){
		b[i][i+2] += 1ll;
	}
	for(i=10; i<20; ++i){
		b[i][i] += 1ll;
		b[i][i+1] += 1ll;
	}
	b[20][20] += 1ll;
}

void mulmat1(){
	int i,j,k;
	for(i=0; i<21; ++i){
		for(j=0; j<21; ++j){
			for(k=0; k<21; ++k){
				add_mod(c[i][j],a[i][k]*b[k][j]%MOD);
			}
		}
	}
	for(i=0; i<21; ++i){
		for(j=0; j<21; ++j){
			a[i][j] = c[i][j];
			c[i][j] = 0ll;
		}
	}
}

void mulmat2(){
	int i,j,k;
	for(i=0; i<21; ++i){
		for(j=0; j<21; ++j){
			for(k=0; k<21; ++k){
				add_mod(c[i][j],b[i][k]*b[k][j]%MOD);
			}
		}
	}
	for(i=0; i<21; ++i){
		for(j=0; j<21; ++j){
			b[i][j] = c[i][j];
			c[i][j] = 0ll;
		}
	}
}

int main(void){
	int i,j,k,t;
	ll n,ans,tmp;
	std::cin >> t;
	while(t--){
		std::cin >> n; ++n;
		init();
		while(n){
			if(n%2){
				mulmat1();
			}
			mulmat2();
			n /= 2;
		}
		std::cout << a[0][20] << std::endl;
	}
	return 0;
}
