#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, i = 1, sum = 0;
  float r = 0.02;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  do {
    sum = sum + m;
    if (i % k == 0)
      m = m - (r * m);
    i = i + 1;
  } while (i <= n);
  printf("%d\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movss  0xebb(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe93(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11be <main+0x9e>
cvtsi2ssl -0xc(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    117a <main+0x5a>
mov    -0x18(%rbp),%esi
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed8(%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    0x8(%rsp),%r8d
mov    0xc(%rsp),%r9d
cmp    $0x2,%r9d
mov    $0x1,%ecx
cmovl  %ecx,%r9d
mov    0x4(%rsp),%edi
neg    %r9d
xor    %esi,%esi
movss  0xe85(%rip),%xmm0
mov    %edi,%ebx
jmp    1193 <main+0x73>
nop
add    %edi,%esi
lea    (%r9,%rcx,1),%eax
add    $0x1,%eax
add    $0x1,%ecx
mov    %ebx,%edi
cmp    $0x1,%eax
je     11b9 <main+0x99>
mov    %ecx,%eax
cltd
idiv   %r8d
test   %edx,%edx
jne    1180 <main+0x60>
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
movaps %xmm1,%xmm2
mulss  %xmm0,%xmm2
addss  %xmm1,%xmm2
cvttss2si %xmm2,%ebx
mov    %ebx,0x4(%rsp)
jmp    1180 <main+0x60>
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [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
%6 = alloca i32
%7 = alloca float
store i32 0, i32* %1
store i32 1, i32* %5
store i32 0, i32* %6
store float 0x3F947AE140000000, float* %7
%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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %11
11: ; preds = %31, %0
%12 = load i32, i32* %6
%13 = load i32, i32* %3
%14 = add nsw i32 %12, %13
store i32 %14, i32* %6
%15 = load i32, i32* %5
%16 = load i32, i32* %4
%17 = srem i32 %15, %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %11
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to float
%22 = load float, float* %7
%23 = load i32, i32* %3
%24 = sitofp i32 %23 to float
%25 = fneg float %22
%26 = call float @llvm.fmuladd.f32(float %25, float %24, float %21)
%27 = fptosi float %26 to i32
store i32 %27, i32* %3
br label %28
28: ; preds = %19, %11
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %31
31: ; preds = %28
%32 = load i32, i32* %5
%33 = load i32, i32* %2
%34 = icmp sle i32 %32, %33
br i1 %34, label %11, label %35
35: ; preds = %31
%36 = load i32, i32* %6
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\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* %3
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32 @llvm.smax.i32(i32 %11, i32 1)
br label %14
14: ; preds = %25, %0
%15 = phi i32 [ %12, %0 ], [ %26, %25 ]
%16 = phi i32 [ 0, %0 ], [ %18, %25 ]
%17 = phi i32 [ 1, %0 ], [ %27, %25 ]
%18 = add nsw i32 %15, %16
%19 = srem i32 %17, %10
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = sitofp i32 %15 to float
%23 = call float @llvm.fmuladd.f32(float %22, float 0xBF947AE140000000, float %22)
%24 = fptosi float %23 to i32
store i32 %24, i32* %2
br label %25
25: ; preds = %21, %14
%26 = phi i32 [ %24, %21 ], [ %15, %14 ]
%27 = add nuw i32 %17, 1
%28 = icmp eq i32 %17, %13
br i1 %28, label %29, label %14
29: ; preds = %25
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
ret i32 0
}