#include<iostream>
#include<vector>
using namespace std;
const int mod = 1e9+7;
int solve(){
int n;cin>>n;
vector<vector<int>> dp(n+1, vector<int>(8, 0));
for(int i=0;i<=5;++i){
dp[1][i] = 1;
}
dp[1][6] = dp[1][7] = 0;
for(int i=2;i<=n;++i){
for(int j=0;j<=5;++j){
for(int k=0;k<=7;++k){
// cout<<i<<" "<<j<<" "<<(j^k)<<endl;
dp[i][k] = (dp[i][k]%mod + dp[i-1][j^k]%mod)%mod;
}
}
}
cout<<dp[n][0]<<endl;
return 0;
}
int main(){
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPHZlY3Rvcj4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKICAgICAgICAgICAgICAgICAgICAgCgpjb25zdCBpbnQgbW9kID0gMWU5Kzc7CiAKIAppbnQgc29sdmUoKXsKICAgIGludCBuO2Npbj4+bjsKICAgIHZlY3Rvcjx2ZWN0b3I8aW50Pj4gZHAobisxLCB2ZWN0b3I8aW50Pig4LCAwKSk7CiAgICBmb3IoaW50IGk9MDtpPD01OysraSl7CiAgICAgICAgZHBbMV1baV0gPSAxOwogICAgfQogICAgZHBbMV1bNl0gPSBkcFsxXVs3XSA9IDA7CiAgICBmb3IoaW50IGk9MjtpPD1uOysraSl7CiAgICAgICAgZm9yKGludCBqPTA7ajw9NTsrK2opewogICAgICAgICAgICBmb3IoaW50IGs9MDtrPD03Oysrayl7CiAgICAgICAgICAgICAgICAvLyBjb3V0PDxpPDwiICI8PGo8PCIgIjw8KGpeayk8PGVuZGw7CiAgICAgICAgICAgICAgICBkcFtpXVtrXSA9IChkcFtpXVtrXSVtb2QgKyBkcFtpLTFdW2pea10lbW9kKSVtb2Q7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBjb3V0PDxkcFtuXVswXTw8ZW5kbDsKCiAgICByZXR1cm4gMDsKfQppbnQgbWFpbigpewogICAgaW50IHQ9MTsKICAgIGNpbj4+dDsKICAgIHdoaWxlKHQtLSl7CiAgICAgICAgc29sdmUoKTsKICAgIH0KCiAgICByZXR1cm4gMDsKfQ==
NjAKMQoyCjMKNAo1CjYKNwo4CjkKMTAKMTEKMTIKMTMKMTQKMTUKMTYKMTcKMTgKMTkKMjAKMjEKMjIKMjMKMjQKMjUKMjYKMjcKMjgKMjkKMzAKMzEKMzIKMzMKMzQKMzUKMzYKMzcKMzgKMzkKNDAKNDEKNDIKNDMKNDQKNDUKNDYKNDcKNDgKNDkKNTAKNTEKNTIKNTMKNTQKNTUKNTYKNTcKNTgKNTkKNjAK
60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60