#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 n, m, k, count, sumM, startMoney, percent;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  sumM = 0;
  startMoney = m;
  percent = 0;
  for (count = 0; count < n; count++) {
    if (count != 0 && count % k == 0) {
      percent = percent + 2;
      m = startMoney - (startMoney * percent / 100);
    }
    sumM = sumM + m;
  }
  printf("%d", sumM);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11df <main+0xbf>
cmpl   $0x0,-0x14(%rbp)
je     11c8 <main+0xa8>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11c8 <main+0xa8>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117a <main+0x5a>
mov    -0x18(%rbp),%esi
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r10d
test   %r10d,%r10d
jle    116d <main+0x4d>
mov    0x4(%rsp),%r8d
cmp    $0x1,%r10d
jne    1183 <main+0x63>
mov    %r8d,%esi
jmp    116f <main+0x4f>
xor    %esi,%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x8(%rsp),%r9d
mov    $0x1,%ecx
xor    %ebx,%ebx
mov    %r8d,%esi
mov    %r8d,%edi
jmp    11aa <main+0x8a>
nopw   0x0(%rax,%rax,1)
add    %edi,%esi
add    $0x1,%ecx
cmp    %ecx,%r10d
je     116f <main+0x4f>
mov    %ecx,%eax
cltd
idiv   %r9d
test   %edx,%edx
jne    11a0 <main+0x80>
add    $0x2,%ebx
mov    %ebx,%eax
imul   %r8d,%eax
cltq
imul   $0xffffffffae147ae1,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x25,%rdi
add    %eax,%edi
add    %r8d,%edi
mov    %edi,0x4(%rsp)
jmp    11a0 <main+0x80>

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

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