import java.util.Scanner;
class Number
{
int a, b;
Number(int z, int x)
{
a = z;
b = x;
}
void Print(int x)
{
if(x == 1)System.out.println(a);
else if(x == 2)System.out.println(b);
else
{
int c = 0, ai = a, bi = b;
for(int i = 3; i <= x; i++)
{
c = 4 * bi - 5 * ai;
ai = bi;
bi = c;
}
System.out.println(c);
}
}
}
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner cin = new Scanner(System.in);
int n, m;
Number num = new Number(0, 1);
n = cin.nextInt();
while(n > 0)
{
n--;
m = cin.nextInt();
num.Print(m);
}
cin.close();
}
}