#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(void) {
  int num, first, percent, gold[1000], sum, i;
  while (1) {
    scanf("%d %d %d", &num, &first, &percent);
    if (num == 0 && first == 0 && percent == 0)
      break;
    sum = 0;
    for (i = 0; i < num; i++) {
      scanf("%d", &gold[i]);
      sum += gold[i];
    }
    if (gold[first - 1] != 0) {
      printf("%d\n", sum * (100 - percent) / gold[first - 1]);
    } else {
      printf("0\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    116f <main+0x4f>
cmpl   $0x0,-0xc(%rbp)
jne    116f <main+0x4f>
cmpl   $0x0,-0x10(%rbp)
jne    116f <main+0x4f>
jmp    1243 <main+0x123>
movl   $0x0,-0xfb4(%rbp)
movl   $0x0,-0xfb8(%rbp)
mov    -0xfb8(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e3 <main+0xc3>
movslq -0xfb8(%rbp),%rax
lea    -0xfb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movslq -0xfb8(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%eax
add    -0xfb4(%rbp),%eax
mov    %eax,-0xfb4(%rbp)
mov    -0xfb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb8(%rbp)
jmp    1183 <main+0x63>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
cmpl   $0x0,-0xfb0(%rbp,%rax,4)
je     1230 <main+0x110>
mov    -0xfb4(%rbp),%eax
mov    $0x64,%ecx
sub    -0x10(%rbp),%ecx
imul   %ecx,%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cltd
idivl  -0xfb0(%rbp,%rcx,4)
mov    %eax,%esi
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123e <main+0x11e>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xfb8,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%eax
test   %ecx,%ecx
jne    1179 <main+0x49>
test   %eax,%eax
jne    1179 <main+0x49>
cmpl   $0x0,0x4(%rsp)
je     1258 <main+0x128>
lea    0xe86(%rip),%rbx
lea    0x8(%rsp),%r13
lea    0x4(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    $0x0,%r15d
test   %ecx,%ecx
jle    11d6 <main+0xa6>
xor    %r12d,%r12d
lea    0x10(%rsp),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    (%r14),%r15d
add    $0x1,%r12
movslq 0xc(%rsp),%rax
add    $0x4,%r14
cmp    %rax,%r12
jl     11b0 <main+0x80>
mov    0x8(%rsp),%eax
cltq
mov    0xc(%rsp,%rax,4),%ecx
test   %ecx,%ecx
je     1210 <main+0xe0>
mov    $0x64,%eax
sub    0x4(%rsp),%eax
imul   %r15d,%eax
cltd
idiv   %ecx
lea    0xe12(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    121c <main+0xec>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xdf6(%rip),%rdi
call   1030 <puts@plt>
lea    0xddd(%rip),%rdi
lea    0xc(%rsp),%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%eax
test   %ecx,%ecx
jne    1190 <main+0x60>
test   %eax,%eax
jne    1190 <main+0x60>
cmpl   $0x0,0x4(%rsp)
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0xfb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [3 x i8] c"0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1000 x i32]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
br label %8
8: ; preds = %0, %59
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %60
19: ; preds = %15, %12, %8
store i32 0, i32* %6
store i32 0, i32* %7
br label %20
20: ; preds = %35, %19
%21 = load i32, i32* %7
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %38
24: ; preds = %20
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %26
%28 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %27)
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = load i32, i32* %6
%34 = add nsw i32 %33, %32
store i32 %34, i32* %6
br label %35
35: ; preds = %24
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %20
38: ; preds = %20
%39 = load i32, i32* %3
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %57
45: ; preds = %38
%46 = load i32, i32* %6
%47 = load i32, i32* %4
%48 = sub nsw i32 100, %47
%49 = mul nsw i32 %46, %48
%50 = load i32, i32* %3
%51 = sub nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = sdiv i32 %49, %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %55)
br label %59
57: ; preds = %38
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %57, %45
br label %8
60: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i32]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast [1000 x i32]* %4 to i8*
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 0
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
%14 = select i1 %11, i1 %13, i1 false
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 0
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %61, label %18
18: ; preds = %0, %51
%19 = phi i32 [ %55, %51 ], [ %12, %0 ]
%20 = phi i32 [ %53, %51 ], [ %10, %0 ]
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %35
22: ; preds = %18, %22
%23 = phi i64 [ %29, %22 ], [ 0, %18 ]
%24 = phi i32 [ %28, %22 ], [ 0, %18 ]
%25 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 %23
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
%27 = load i32, i32* %25
%28 = add nsw i32 %27, %24
%29 = add nuw nsw i64 %23, 1
%30 = load i32, i32* %1
%31 = sext i32 %30 to i64
%32 = icmp slt i64 %29, %31
br i1 %32, label %22, label %33
33: ; preds = %22
%34 = load i32, i32* %2
br label %35
35: ; preds = %33, %18
%36 = phi i32 [ %19, %18 ], [ %34, %33 ]
%37 = phi i32 [ 0, %18 ], [ %28, %33 ]
%38 = add nsw i32 %36, -1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = icmp eq i32 %41, 0
br i1 %42, label %49, label %43
43: ; preds = %35
%44 = load i32, i32* %3
%45 = sub nsw i32 100, %44
%46 = mul nsw i32 %45, %37
%47 = sdiv i32 %46, %41
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %51
49: ; preds = %35
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %51
51: ; preds = %49, %43
%52 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%53 = load i32, i32* %1
%54 = icmp eq i32 %53, 0
%55 = load i32, i32* %2
%56 = icmp eq i32 %55, 0
%57 = select i1 %54, i1 %56, i1 false
%58 = load i32, i32* %3
%59 = icmp eq i32 %58, 0
%60 = select i1 %57, i1 %59, i1 false
br i1 %60, label %61, label %18
61: ; preds = %51, %0
ret i32 0
}