#include<bits/stdc++.h>
#include<iostream>
#define LL long long
#define GG int
#define For(i, j, k) for(int i=j; i<=k; i++)
#define Dow(i, j, k) for(int i=j; i>=k; i--)
inline GG read() {
GG x = 0, f = 1;
char ch = getchar();
while(ch<'0'||ch>'9') { if(ch=='-') f = -1; ch = getchar(); }
while(ch>='0'&&ch<='9') { x = x*10+ch-48; ch = getchar(); }
return x * f;
}
const int N = 10;
int n, m, num;
LL f[1000], t1;
int main() {
int T;
scanf("%d", &T);
f[1] = 1; f[2] = 3;
For(i, 3, 50) f[i] = f[i-1]+2*f[i-2];
while(T--) {
scanf("%d", &n);
printf("%lld\n", f[n]);
}
return 0;
}