#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 */
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t, n, i, j, count = 0;
  int k = 1;
  scanf("%d", &t);
  for (i = 0; i < t; i++) {
    scanf("%d", &n);
    for (j = 1; j <= n; j++) {
      k *= 2;
      count++;
      if (count == 10) {
        k = k % (int)pow(10, 5);
        count = 0;
      }
    }
    printf("%ld\n", (k - 1) % (int)pow(10, 5));
    k = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122e <main+0xfe>
lea    0xe89(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11ea <main+0xba>
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jne    11d7 <main+0xa7>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0xa,%edi
mov    $0x5,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
jmp    11dc <main+0xac>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1187 <main+0x57>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    $0xa,%edi
mov    $0x5,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x24(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xdef(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1164 <main+0x34>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11f3 <main+0xc3>
xor    %ebx,%ebx
mov    %rsp,%r15
lea    0xea0(%rip),%r12
xor    %r13d,%r13d
jmp    119f <main+0x6f>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
mov    $0xa,%edi
mov    $0x5,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %r12,%rdi
mov    %edx,%esi
call   1030 <printf@plt>
add    $0x1,%r13d
cmp    0x4(%rsp),%r13d
jge    11f3 <main+0xc3>
lea    0xe5a(%rip),%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
mov    $0x1,%ebp
test   %eax,%eax
jle    1170 <main+0x40>
xor    %r14d,%r14d
jmp    11c9 <main+0x99>
nop
add    $0x1,%r14d
cmp    %eax,%r14d
jge    1170 <main+0x40>
add    %ebp,%ebp
add    $0x1,%ebx
cmp    $0xa,%ebx
jne    11c0 <main+0x90>
mov    $0xa,%edi
mov    $0x5,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
cltd
idiv   %ecx
xor    %ebx,%ebx
mov    (%rsp),%eax
mov    %edx,%ebp
jmp    11c0 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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