import java.util.Scanner;
public class P2563{
private static long[] a=new long[21];
static{
a[1]=3;
a[2]=7;
for(int i=3;i<21;i++){
a[i]=2*a[i-1]+a[i-2];
}
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int c=sc.nextInt();
while(c-->0){
int n=sc.nextInt();
System.out.println(a[n]);
}
}
}
public class P2563{
private static long[] a=new long[21];
static{
a[1]=3;
a[2]=7;
for(int i=3;i<21;i++){
a[i]=2*a[i-1]+a[i-2];
}
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int c=sc.nextInt();
while(c-->0){
int n=sc.nextInt();
System.out.println(a[n]);
}
}
}