#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 *, unsigned long long);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t, i, n;
  unsigned long long int power[70];
  power[0] = 1;
  power[1] = 3;
  for (i = 2; i <= 70; i++) {
    power[i] = power[i - 1] * 3;
  }
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    printf("%llu\n", power[n] - 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1,-0x240(%rbp)
movq   $0x3,-0x238(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x46,-0xc(%rbp)
jg     1184 <main+0x64>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
imul   $0x3,-0x240(%rbp,%rax,8),%rcx
ff 03
movslq -0xc(%rbp),%rax
mov    %rcx,-0x240(%rbp,%rax,8)
ff
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <main+0x2f>
lea    0xe75(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11d9 <main+0xb9>
lea    0xe51(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movslq -0x10(%rbp),%rax
mov    -0x240(%rbp,%rax,8),%rsi
ff
sub    $0x1,%rsi
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
jmp    1194 <main+0x74>
xor    %eax,%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x240,%rsp
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    $0x3,%ecx
mov    $0x4,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%rcx,%rcx,2),%rdx
mov    %rdx,(%rsp,%rax,8)
lea    (%rcx,%rcx,8),%rcx
mov    %rcx,0x8(%rsp,%rax,8)
lea    (%rcx,%rcx,2),%rcx
mov    %rcx,0x10(%rsp,%rax,8)
add    $0x3,%rax
cmp    $0x49,%rax
jne    1150 <main+0x30>
lea    0xe95(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x8(%rsp)
jb     11c8 <main+0xa8>
lea    0xe7d(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xe74(%rip),%rbx
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
mov    0x10(%rsp,%rax,8),%rsi
add    $0xffffffffffffffff,%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
subl   $0x1,0x8(%rsp)
jae    11a0 <main+0x80>
xor    %eax,%eax
add    $0x240,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [70 x i64]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [70 x i64]* %3 to i8*
%7 = bitcast [70 x i64]* %3 to <2 x i64>*
store <2 x i64> <i64 1, i64 3>, <2 x i64>* %7
br label %8
8: ; preds = %8, %0
%9 = phi i64 [ 3, %0 ], [ %17, %8 ]
%10 = phi i64 [ 2, %0 ], [ %19, %8 ]
%11 = mul i64 %9, 3
%12 = getelementptr inbounds [70 x i64], [70 x i64]* %3, i64 0, i64 %10
store i64 %11, i64* %12
%13 = add nuw nsw i64 %10, 1
%14 = mul i64 %9, 9
%15 = getelementptr inbounds [70 x i64], [70 x i64]* %3, i64 0, i64 %13
store i64 %14, i64* %15
%16 = add nuw nsw i64 %10, 2
%17 = mul i64 %9, 27
%18 = getelementptr inbounds [70 x i64], [70 x i64]* %3, i64 0, i64 %16
store i64 %17, i64* %18
%19 = add nuw nsw i64 %10, 3
%20 = icmp eq i64 %19, 71
br i1 %20, label %21, label %8
21: ; preds = %8
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%23 = load i32, i32* %1
%24 = add nsw i32 %23, -1
store i32 %24, i32* %1
%25 = icmp eq i32 %23, 0
br i1 %25, label %37, label %26
26: ; preds = %21, %26
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [70 x i64], [70 x i64]* %3, i64 0, i64 %29
%31 = load i64, i64* %30
%32 = add i64 %31, -1
%33 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %32)
%34 = load i32, i32* %1
%35 = add nsw i32 %34, -1
store i32 %35, i32* %1
%36 = icmp eq i32 %34, 0
br i1 %36, label %37, label %26
37: ; preds = %26, %21
ret i32 0
}