import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int[] n = {1, 2, 4, 7, 13, 24, 44, 81, 149, 274};
// n[0] = 1;
// n[1] = 2;
// n[2] = 4;
//
// for(int i = 3 ; i < 10 ; i++) {
// n[i] = n[i-1] + n[i-2] + n[i-3];
// }
//
// System.out.println(Arrays.toString(n));
int TC = Integer.parseInt(br.readLine());
for(int i = 0 ; i<TC ; i++) {
int N = Integer.parseInt(br.readLine());
System.out.println(n[N-1]);
}
}
}