#include<bits/stdc++.h>
using namespace std;
long long dp[255][5][5][5][5];
const long long MOD=1E9+7;
long long n;
long long f(int ind,int a,int b,int c,int d)
{
if(ind==n)
{
return 1;
}
if(dp[ind][a][b][c][d]!=-1)
return dp[ind][a][b][c][d];
long long answ=0;
int i,j;
if(ind==0||ind==1)
{
for(i=0;i<4;i++)
{
answ+=f(ind+1,b,c,d,i);
answ=answ%MOD;
}
}
else if(ind==2)
{
for(i=0;i<4;i++)
{
if(i!=c)
{
answ+=f(ind+1,b,c,d,i);
answ=answ%MOD;
}
}
}
else
{
for(i=0;i<4;i++)
{
int isOk=1;
if(i!=c)
{
if(b==0&&c==1&&d==2&&i==3)
isOk=0;
if(b==1&&c==2&&d==3&&i==0)
isOk=0;
if(b==2&&c==3&&d==0&&i==1)
isOk=0;
if(b==3&&c==0&&d==1&&i==2)
isOk=0;
if(b==0&&c==3&&d==2&&i==1)
isOk=0;
if(b==3&&c==2&&d==1&&i==0)
isOk=0;
if(b==2&&c==1&&d==0&&i==3)
isOk=0;
if(b==1&&c==0&&d==3&&i==2)
isOk=0;
if(isOk)
{
answ+=f(ind+1,b,c,d,i);
answ=answ%MOD;
}
}
}
}
return dp[ind][a][b][c][d]=answ;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
memset(dp,-1,sizeof(dp));
scanf("%lld",&n);
long long answ=f(0,0,0,0,0);
cout<<answ<<"\n";
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKbG9uZyBsb25nIGRwWzI1NV1bNV1bNV1bNV1bNV07CmNvbnN0IGxvbmcgbG9uZyBNT0Q9MUU5Kzc7CmxvbmcgbG9uZyBuOwpsb25nIGxvbmcgZihpbnQgaW5kLGludCBhLGludCBiLGludCBjLGludCBkKQp7CglpZihpbmQ9PW4pCgl7CgkJcmV0dXJuIDE7Cgl9CglpZihkcFtpbmRdW2FdW2JdW2NdW2RdIT0tMSkKCXJldHVybiBkcFtpbmRd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