#include<bits/stdc++.h>
using namespace std;
const int N = 1e3+100;
const int P = 1e9+7;
#define fr(i,a,b) for(int i = a;i <= b; ++i)
#define nfr(i,a,b) for(int i = a;i >= b; --i)
#define pb push_back

int f[N][17];
int n;

inline int pow_mod(int x,int k){
   int res = 1,base = x;
   while(k){
      if(k&1)res = 1LL*res*base%P;
      k >>= 1; base = 1LL*base*base%P;
   }
   return res;
}

inline void add(int &x,int y){
   x += y; if(x >= P)x -= P;
}

void init(){
   memset(f,0,sizeof f);
   f[0][1] = f[0][3] = f[0][5] = f[0][7] = f[0][9] = f[0][11] = 1;
   fr(i,1,N-1){
      fr(j,1,15){
         if(j <= 10){
            if(j%2 == 0){
               for(int w = j-1;w <= 11; w += 2)
                  add(f[i][w],f[i-1][j]);
            } else {
               add(f[i][j+1],f[i-1][j]);
            }
         } else {
            fr(w,0,i-1){
               add(f[i][j+1],1LL*f[w][j]*(i-w)%P);
            }
         }
      }
      add(f[i][16],f[i-1][16]);
   }
}

int lagrange_interpolation(vector<int> val,int x){
   int sz = 15;
   int ans = 0;

   fr(i,0,sz){
      int res = val[i];
      fr(j,0,sz){
         if(j == i)continue ;
         res = 1LL*res*pow_mod(P+i-j,P-2)%P*(P+x-j)%P;
      }
      add(ans,res);
   }
   return ans;
}

void solve(){
   int n; scanf("%d",&n);
   if(n < 5)puts("0");
   else {
      int z = n%2 == 0;
      n = (n-5)/2;
      vector<int> v;
      if(z){
         for(int i = 6;i <= 36;i += 2)v.pb(f[i][16]);
      } else {
         for(int i = 5;i <= 35;i += 2)v.pb(f[i][16]);
      }
      printf("%d\n",lagrange_interpolation(v,n));
   }
   return ;
}

int main(){
   init();
   int t; scanf("%d",&t); while(t--)solve();
}
