#include <bits/stdc++.h>
using namespace std;

using dbl=double;
using ll=long long;
using pii=pair<int, int>;
using pll=pair<ll, ll>;

#define sz(a) ((int)a.size())
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define forse(i,s,e) for(int i=(int)s;i<(int)e;i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

const dbl PI=3.141592653589793;

//Modular arithmetic
template<int P>
class modular{
	public:
		static int init_siz;
		static vector<modular> inverse,factorial;
		int n=0;
		static modular exp(modular a, long long e) {
			modular res = 1; while (e) { if (e&1) res *= a; a *= a; e >>= 1; }
			return res;
		}
		static void init(int n){
			init_siz=n;
			inverse.resize(n+1);factorial.resize(n+1);
			factorial[0] = 1;
			for (int i = 1; i <= n; i++) factorial[i] = factorial[i - 1] * i;
			inverse[n]=exp(factorial[n],P-2);
			for (int i = n-1; i>=0; i--) inverse[i] = inverse[i+1] * (i+1);
		}
		static modular inv(modular const& a){
			assert(a.n!=0);
			return (init_siz>=a.n? inverse[a.n]*fac(a-1):exp(a,P-2));
		}
		static modular ifac(modular const& a){
			return (init_siz>=a.n? inverse[a.n]:exp(fac(a),P-2));
		}
		static modular fac(modular const& a){
			if(init_siz>=a.n) return factorial[a.n];
			else{
				modular out=1;
				for(int i=0;i<a.n;i++) out*=(i+1);
				return out;
			}
		}
		modular(long long val = 0) {n=val%P;if(n<0) n+=P;}
		modular& operator+=(modular const& b) {n += b.n; if (n >= P) n -= P; return *this;}
		modular& operator-=(modular const& b) {n -= b.n; if (n < 0) n += P;return *this;}
		modular& operator*=(modular const& b) {n = (long long)n * b.n % P;return *this;}
		modular exp(long long e) {return exp(*this,e);}
		modular inv(){return inv(*this);}
		modular& operator/=(modular const& b){ return *this *=inv(b);}	
		friend std::ostream& operator<<(std::ostream& os,modular const& a){return os<<a.n;}
		friend modular operator+(modular a, modular const b) { return a += b; }
		friend modular operator-(modular a, modular const b) { return a -= b; }
		friend modular operator-(modular const a) { return 0 - a; }
		friend modular operator*(modular a, modular const b) { return a *= b; }
		friend modular operator/(modular a, modular const b) { return a /= b; }
		friend bool operator==(modular const& a, modular const& b) {return a.n == b.n;}
		friend bool operator!=(modular const& a, modular const& b) {return a.n != b.n;}
};
template<int P> int modular<P>::init_siz=-1;
template<int P> vector<modular<P>> modular<P>::factorial;
template<int P> vector<modular<P>> modular<P>::inverse;
template<int P> string to_string(modular<P> b) { return to_string(b.n);}
const int P=1e9+7;
typedef modular<P> mint;

mint comb(int n,int x){
	mint out=1;
	forse(i,1,x+1){
		out*=(n+i);
		out/=i;
	}
	return out;
}

void solve(){
	vector<mint> num={969,51,17,1,1,969,765,595,455,1365,1001,715,495,165,105,63,35,35,15,5,1};
	vector<mint> den={262144,32768,32768,8192,65536,262144,131072,65536,32768,65536,32768,
	16384,8192,2048,1024,512,256,256,128,64,32};
	forn(i,sz(num)) num[i]/=den[i];
	int posn=5;
	int t;
	cin >> t;
	while(t--){
		int n;
		cin >> n;
		n-=5;
		if(n<0){
			cout << "0\n";
			continue;
		}
		mint out=0;
		forn(i,posn){
			if(n&1) out-=num[i]*comb(n,i);
			else out+=num[i]*comb(n,i);
		}
		forse(i,posn,sz(num)){
			out+=num[i]*comb(n,i-posn);
		}
		cout << out << '\n';
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int T=1;
//	cin >> T;
	for(int c=1;c<=T;c++){
		solve();
	}
}


Measured memory_bytes: 3660