#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 */
long long modRecursion(int, long long, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long long *);
int main(void) {
  long long t, n;
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld", &n);
    if (n == 1) {
      printf("0\n");
      continue;
    }
    long long ans = 1, i;
    i = modRecursion(2, n - 1, 1000000007);
    ans = i - 2;
    printf("%lld\n", ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     11dc <main+0xac>
lea    0xe91(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmpq   $0x1,-0x18(%rbp)
jne    1196 <main+0x66>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114f <main+0x1f>
movq   $0x1,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
sub    $0x1,%rsi
mov    $0x2,%edi
mov    $0x3b9aca07,%edx
call   1040 <modRecursion@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
sub    $0x2,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114f <main+0x1f>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeae(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
subq   $0x1,0x8(%rsp)
jb     11cf <main+0x8f>
lea    0xe95(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe94(%rip),%r15
lea    0xe87(%rip),%r12
jmp    1190 <main+0x50>
mov    %r15,%rdi
call   1030 <puts@plt>
subq   $0x1,0x8(%rsp)
jb     11cf <main+0x8f>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x10(%rsp),%rsi
cmp    $0x1,%rsi
je     1180 <main+0x40>
add    $0xffffffffffffffff,%rsi
mov    $0x2,%edi
mov    $0x3b9aca07,%edx
call   1050 <modRecursion@plt>
lea    -0x2(%rax),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
subq   $0x1,0x8(%rsp)
jae    1190 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
br label %7
7: ; preds = %17, %15, %0
%8 = load i64, i64* %2
%9 = add nsw i64 %8, -1
store i64 %9, i64* %2
%10 = icmp ne i64 %8, 0
br i1 %10, label %11, label %25
11: ; preds = %7
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %3)
%13 = load i64, i64* %3
%14 = icmp eq i64 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %7
17: ; preds = %11
store i64 1, i64* %4
%18 = load i64, i64* %3
%19 = sub nsw i64 %18, 1
%20 = call i64 @modRecursion(i32 2, i64 %19, i32 1000000007)
store i64 %20, i64* %5
%21 = load i64, i64* %5
%22 = sub nsw i64 %21, 2
store i64 %22, i64* %4
%23 = load i64, i64* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %23)
br label %7
25: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.2 = [6 x i8] c"%lld\0A\00"
@str = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%6 = load i64, i64* %1
%7 = add nsw i64 %6, -1
store i64 %7, i64* %1
%8 = icmp eq i64 %6, 0
br i1 %8, label %24, label %9
9: ; preds = %0, %15
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%11 = load i64, i64* %2
%12 = icmp eq i64 %11, 1
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %19
%16 = load i64, i64* %1
%17 = add nsw i64 %16, -1
store i64 %17, i64* %1
%18 = icmp eq i64 %16, 0
br i1 %18, label %24, label %9
19: ; preds = %9
%20 = add nsw i64 %11, -1
%21 = call i64 @modRecursion(i32 2, i64 %20, i32 1000000007)
%22 = add nsw i64 %21, -2
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %22)
br label %15
24: ; preds = %15, %0
ret i32 0
}