#include<bits/stdc++.h>
using namespace std;
const long long N=1e+7+10,d=1e9+7;
long long f[N];
long long F(long long n)
{
if(f[n]) return f[n];
if(n==2||n==1) return f[n]=0;
if(n==3) return f[n]=2;
if(n==4) return f[n]=6;
else return f[n]=(2*F(n-1)+2)%d;
}
int main()
{
freopen("obsession.in","r",stdin);
freopen("obsession.out","w",stdout);
int t,n;
cin>>t;
for(int i=1;i<=t;i++)
{
cin>>n;
cout<<F(n)<<endl;
}
return 0;
}