#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 val, sum = 0, bank = 0;
  for (int i = 1; i <= 12; i++) {
    scanf("%d", &val);
    sum += 300 - val;
    if (sum < 0) {
      printf("-%d\n", i);
      return 0;
    }
    bank += 100 * (sum / 100);
    sum %= 100;
  }
  printf("%d\n", sum + bank * 120 / 100);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0xc,-0x14(%rbp)
jg     11c1 <main+0xa1>
lea    0xeab(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x12c,%eax
sub    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1191 <main+0x71>
mov    -0x14(%rbp),%esi
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11de <main+0xbe>
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
imul   $0x64,%eax,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <main+0x24>
mov    -0xc(%rbp),%esi
imul   $0x78,-0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
add    %eax,%esi
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
mov    $0x1,%r12d
lea    0xec5(%rip),%r14
lea    0xc(%rsp),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
sub    0xc(%rsp),%ebp
add    $0x12c,%ebp
js     11ab <main+0x8b>
mov    %ebp,%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
imul   $0x64,%eax,%eax
add    %ebp,%ebx
sub    %eax,%ebp
sub    %ebp,%ebx
add    $0x1,%r12d
cmp    $0xd,%r12d
jne    1150 <main+0x30>
imul   $0x78,%ebx,%eax
cltq
imul   $0x51eb851f,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x25,%rsi
add    %eax,%esi
add    %ebp,%esi
lea    0xe5b(%rip),%rdi
jmp    11b5 <main+0x95>
lea    0xe51(%rip),%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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