#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int totalTestCases;
  int testCase[9];
  scanf("%d", &totalTestCases);
  for (int i = 0; i < totalTestCases; i++) {
    scanf("%d", &testCase[i]);
  }
  for (int x = 0; x < totalTestCases; x++) {
    int state = 0;
    int sapHeight = 1;
    for (int y = 0; y < testCase[x]; y++) {
      if (state < 1) {
        sapHeight *= 2;
        state = 1;
      } else {
        sapHeight += 1;
        state = 0;
      }
    }
    printf("%d\n", sapHeight);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    117b <main+0x5b>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe98(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1146 <main+0x26>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1213 <main+0xf3>
movl   $0x0,-0x3c(%rbp)
movl   $0x1,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
movslq -0x38(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jge    11f6 <main+0xd6>
cmpl   $0x1,-0x3c(%rbp)
jge    11d3 <main+0xb3>
mov    -0x40(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x40(%rbp)
movl   $0x1,-0x3c(%rbp)
jmp    11e3 <main+0xc3>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x3c(%rbp)
jmp    11e8 <main+0xc8>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11a3 <main+0x83>
mov    -0x40(%rbp),%esi
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1182 <main+0x62>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11e7 <main+0xc7>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xead(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1160 <main+0x40>
test   %eax,%eax
jle    11e7 <main+0xc7>
xor    %ebx,%ebx
lea    0xe79(%rip),%r14
jmp    11af <main+0x8f>
nopl   0x0(%rax)
mov    %ecx,%esi
add    %ecx,%esi
test   $0x1,%al
cmove  %ecx,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jge    11e7 <main+0xc7>
mov    0x10(%rsp,%rbx,4),%eax
test   %eax,%eax
jle    11e0 <main+0xc0>
mov    $0x1,%ecx
cmp    $0x1,%eax
je     1190 <main+0x70>
mov    %eax,%edx
and    $0xfffffffe,%edx
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
add    %ecx,%ecx
add    $0x1,%ecx
add    $0xfffffffe,%edx
jne    11d0 <main+0xb0>
jmp    1190 <main+0x70>
nopl   0x0(%rax)
mov    $0x1,%esi
jmp    1199 <main+0x79>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [9 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %4
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
br label %19
19: ; preds = %14
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %10
22: ; preds = %10
store i32 0, i32* %5
br label %23
23: ; preds = %51, %22
%24 = load i32, i32* %5
%25 = load i32, i32* %2
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %54
27: ; preds = %23
store i32 0, i32* %6
store i32 1, i32* %7
store i32 0, i32* %8
br label %28
28: ; preds = %45, %27
%29 = load i32, i32* %8
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = icmp slt i32 %29, %33
br i1 %34, label %35, label %48
35: ; preds = %28
%36 = load i32, i32* %6
%37 = icmp slt i32 %36, 1
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32, i32* %7
%40 = mul nsw i32 %39, 2
store i32 %40, i32* %7
store i32 1, i32* %6
br label %44
41: ; preds = %35
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
store i32 0, i32* %6
br label %44
44: ; preds = %41, %38
br label %45
45: ; preds = %44
%46 = load i32, i32* %8
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %28
48: ; preds = %28
%49 = load i32, i32* %7
%50 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %48
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %23
54: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [9 x i32]* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %10, label %28
8: ; preds = %10
%9 = icmp sgt i32 %15, 0
br i1 %9, label %18, label %28
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %8
18: ; preds = %8, %35
%19 = phi i64 [ %38, %35 ], [ 0, %8 ]
%20 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %35
23: ; preds = %18
%24 = and i32 %21, 1
%25 = icmp eq i32 %21, 1
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = and i32 %21, -2
br label %42
28: ; preds = %35, %0, %8
ret i32 0
29: ; preds = %42, %23
%30 = phi i32 [ undef, %23 ], [ %46, %42 ]
%31 = phi i32 [ 1, %23 ], [ %46, %42 ]
%32 = icmp eq i32 %24, 0
%33 = shl nsw i32 %31, 1
%34 = select i1 %32, i32 %30, i32 %33
br label %35
35: ; preds = %29, %18
%36 = phi i32 [ 1, %18 ], [ %34, %29 ]
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = add nuw nsw i64 %19, 1
%39 = load i32, i32* %1
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %18, label %28
42: ; preds = %42, %26
%43 = phi i32 [ 1, %26 ], [ %46, %42 ]
%44 = phi i32 [ 0, %26 ], [ %47, %42 ]
%45 = shl nsw i32 %43, 1
%46 = or i32 %45, 1
%47 = add i32 %44, 2
%48 = icmp eq i32 %47, %27
br i1 %48, label %29, label %42
}