#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t, i, j, k, l, f, min, a[10];
  scanf("%d", &t);
  while (t--) {
    min = 10001;
    for (i = 0; i < 10; i++)
      scanf("%d", &a[i]);
    for (i = 0; i < 10; i++) {
      if (a[i] < min) {
        min = a[i];
        f = i;
      }
    }
    if (f == 0) {
      printf("1");
      for (i = 0; i <= min; i++)
        printf("0");
      printf("\n");
    } else {
      for (i = 0; i <= min; i++)
        printf("%d", f);
      printf("\n");
    }
  }
  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>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1279 <main+0x159>
movl   $0x2711,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1194 <main+0x74>
movslq -0xc(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7f(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <main+0x41>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11da <main+0xba>
movslq -0xc(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
cmp    -0x20(%rbp),%eax
jge    11c7 <main+0xa7>
movslq -0xc(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11cc <main+0xac>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119b <main+0x7b>
cmpl   $0x0,-0x1c(%rbp)
jne    1234 <main+0x114>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1221 <main+0x101>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f9 <main+0xd9>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1274 <main+0x154>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1266 <main+0x146>
mov    -0x1c(%rbp),%esi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    123b <main+0x11b>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xebb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1167 <main+0x37>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe92(%rip),%r13
mov    $0x7,%r15d
mov    $0x8,%ebx
mov    $0x9,%r12d
jmp    11a1 <main+0x71>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
subl   $0x1,0xc(%rsp)
jb     1156 <main+0x26>
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
lea    0x14(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
lea    0x18(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
lea    0x1c(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
lea    0x20(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
lea    0x24(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
lea    0x28(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
lea    0x2c(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
lea    0x30(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
lea    0x34(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x10(%rsp),%r14d
cmp    $0x2711,%r14d
mov    $0x0,%eax
cmovl  %eax,%ebp
mov    $0x2711,%eax
cmovge %eax,%r14d
mov    0x14(%rsp),%eax
cmp    %r14d,%eax
mov    $0x1,%ecx
cmovl  %ecx,%ebp
cmovl  %eax,%r14d
mov    0x18(%rsp),%eax
cmp    %r14d,%eax
mov    $0x2,%ecx
cmovl  %ecx,%ebp
cmovl  %eax,%r14d
mov    0x1c(%rsp),%eax
cmp    %r14d,%eax
mov    $0x3,%ecx
cmovl  %ecx,%ebp
cmovl  %eax,%r14d
mov    0x20(%rsp),%eax
cmp    %r14d,%eax
mov    $0x4,%ecx
cmovl  %ecx,%ebp
cmovl  %eax,%r14d
mov    0x24(%rsp),%eax
cmp    %r14d,%eax
mov    $0x5,%ecx
cmovl  %ecx,%ebp
cmovl  %eax,%r14d
mov    0x28(%rsp),%eax
cmp    %r14d,%eax
mov    $0x6,%ecx
cmovl  %ecx,%ebp
cmovl  %eax,%r14d
mov    0x2c(%rsp),%eax
cmp    %r14d,%eax
cmovl  %r15d,%ebp
cmovl  %eax,%r14d
mov    0x30(%rsp),%eax
cmp    %r14d,%eax
cmovl  %ebx,%ebp
cmovl  %eax,%r14d
mov    0x34(%rsp),%eax
cmp    %r14d,%eax
cmovl  %r12d,%ebp
cmovl  %eax,%r14d
test   %ebp,%ebp
je     1310 <main+0x1e0>
test   %r14d,%r14d
js     1190 <main+0x60>
add    $0x1,%r14d
nop
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%r14d
jne    12f0 <main+0x1c0>
jmp    1190 <main+0x60>
nopw   0x0(%rax,%rax,1)
mov    $0x31,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
js     1190 <main+0x60>
add    $0x1,%r14d
nopw   0x0(%rax,%rax,1)
mov    $0x30,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r14d
jne    1330 <main+0x200>
jmp    1190 <main+0x60>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [2 x i8] c"\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
%8 = alloca i32
%9 = alloca [10 x i32]
store i32 0, i32* %1
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %77, %0
%12 = load i32, i32* %2
%13 = add nsw i32 %12, -1
store i32 %13, i32* %2
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %78
15: ; preds = %11
store i32 10001, i32* %8
store i32 0, i32* %3
br label %16
16: ; preds = %24, %15
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 10
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %21
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %22)
br label %24
24: ; preds = %19
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %16
27: ; preds = %16
store i32 0, i32* %3
br label %28
28: ; preds = %45, %27
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 10
br i1 %30, label %31, label %48
31: ; preds = %28
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = load i32, i32* %8
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %44
38: ; preds = %31
%39 = load i32, i32* %3
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i64 0, i64 %40
%42 = load i32, i32* %41
store i32 %42, i32* %8
%43 = load i32, i32* %3
store i32 %43, i32* %7
br label %44
44: ; preds = %38, %31
br label %45
45: ; preds = %44
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %28
48: ; preds = %28
%49 = load i32, i32* %7
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %64
51: ; preds = %48
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %53
53: ; preds = %59, %51
%54 = load i32, i32* %3
%55 = load i32, i32* %8
%56 = icmp sle i32 %54, %55
br i1 %56, label %57, label %62
57: ; preds = %53
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %59
59: ; preds = %57
%60 = load i32, i32* %3
%61 = add nsw i32 %60, 1
store i32 %61, i32* %3
br label %53
62: ; preds = %53
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %77
64: ; preds = %48
store i32 0, i32* %3
br label %65
65: ; preds = %72, %64
%66 = load i32, i32* %3
%67 = load i32, i32* %8
%68 = icmp sle i32 %66, %67
br i1 %68, label %69, label %75
69: ; preds = %65
%70 = load i32, i32* %7
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %69
%73 = load i32, i32* %3
%74 = add nsw i32 %73, 1
store i32 %74, i32* %3
br label %65
75: ; preds = %65
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %77
77: ; preds = %75, %62
br label %11
78: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [10 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 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %93, label %9
9: ; preds = %0
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 3
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 4
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 5
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 6
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 7
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 8
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
br label %20
20: ; preds = %9, %88
%21 = phi i32 [ %70, %88 ], [ undef, %9 ]
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %13)
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %15)
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %18)
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%32 = load i32, i32* %10
%33 = icmp slt i32 %32, 10001
%34 = select i1 %33, i32 0, i32 %21
%35 = select i1 %33, i32 %32, i32 10001
%36 = load i32, i32* %11
%37 = icmp slt i32 %36, %35
%38 = select i1 %37, i32 1, i32 %34
%39 = select i1 %37, i32 %36, i32 %35
%40 = load i32, i32* %12
%41 = icmp slt i32 %40, %39
%42 = select i1 %41, i32 2, i32 %38
%43 = select i1 %41, i32 %40, i32 %39
%44 = load i32, i32* %13
%45 = icmp slt i32 %44, %43
%46 = select i1 %45, i32 3, i32 %42
%47 = select i1 %45, i32 %44, i32 %43
%48 = load i32, i32* %14
%49 = icmp slt i32 %48, %47
%50 = select i1 %49, i32 4, i32 %46
%51 = select i1 %49, i32 %48, i32 %47
%52 = load i32, i32* %15
%53 = icmp slt i32 %52, %51
%54 = select i1 %53, i32 5, i32 %50
%55 = select i1 %53, i32 %52, i32 %51
%56 = load i32, i32* %16
%57 = icmp slt i32 %56, %55
%58 = select i1 %57, i32 6, i32 %54
%59 = select i1 %57, i32 %56, i32 %55
%60 = load i32, i32* %17
%61 = icmp slt i32 %60, %59
%62 = select i1 %61, i32 7, i32 %58
%63 = select i1 %61, i32 %60, i32 %59
%64 = load i32, i32* %18
%65 = icmp slt i32 %64, %63
%66 = select i1 %65, i32 8, i32 %62
%67 = select i1 %65, i32 %64, i32 %63
%68 = load i32, i32* %19
%69 = icmp slt i32 %68, %67
%70 = select i1 %69, i32 9, i32 %66
%71 = select i1 %69, i32 %68, i32 %67
%72 = icmp eq i32 %70, 0
br i1 %72, label %75, label %73
73: ; preds = %20
%74 = icmp slt i32 %71, 0
br i1 %74, label %88, label %83
75: ; preds = %20
%76 = call i32 @putchar(i32 49)
%77 = icmp slt i32 %71, 0
br i1 %77, label %88, label %78
78: ; preds = %75, %78
%79 = phi i32 [ %81, %78 ], [ 0, %75 ]
%80 = call i32 @putchar(i32 48)
%81 = add nuw nsw i32 %79, 1
%82 = icmp eq i32 %79, %71
br i1 %82, label %88, label %78
83: ; preds = %73, %83
%84 = phi i32 [ %86, %83 ], [ 0, %73 ]
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %70)
%86 = add nuw nsw i32 %84, 1
%87 = icmp eq i32 %84, %71
br i1 %87, label %88, label %83
88: ; preds = %83, %78, %73, %75
%89 = call i32 @putchar(i32 10)
%90 = load i32, i32* %1
%91 = add nsw i32 %90, -1
store i32 %91, i32* %1
%92 = icmp eq i32 %90, 0
br i1 %92, label %93, label %20
93: ; preds = %88, %0
ret i32 0
}