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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11fc <main+0xdc>
mov    -0x1c(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    11e9 <main+0xc9>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm1
cvtsi2ssl -0x10(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
jmp    11ee <main+0xce>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117b <main+0x5b>
mov    -0x1c(%rbp),%esi
lea    0xe02(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeec(%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),%edi
test   %edi,%edi
jle    11cf <main+0xaf>
mov    0x4(%rsp),%ebx
cvtsi2ss %ebx,%xmm0
mov    0x8(%rsp),%r8d
movaps 0xe91(%rip),%xmm1
xorps  %xmm0,%xmm1
neg    %edi
mov    $0x1,%ecx
xor    %esi,%esi
xorps  %xmm3,%xmm3
movsd  0xe8a(%rip),%xmm2
jmp    11c1 <main+0xa1>
nopl   0x0(%rax,%rax,1)
cvtss2sd %xmm3,%xmm3
addsd  %xmm2,%xmm3
cvtsd2ss %xmm3,%xmm3
movaps %xmm1,%xmm4
mulss  %xmm3,%xmm4
addss  %xmm0,%xmm4
cvttss2si %xmm4,%eax
mov    %eax,0x4(%rsp)
add    %ebx,%esi
lea    (%rdi,%rcx,1),%edx
add    $0x1,%edx
add    $0x1,%ecx
mov    %eax,%ebx
cmp    $0x1,%edx
je     11d1 <main+0xb1>
mov    %ecx,%eax
cltd
idiv   %r8d
test   %edx,%edx
je     1190 <main+0x70>
mov    %ebx,%eax
jmp    11af <main+0x8f>
xor    %esi,%esi
lea    0xe40(%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"
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 float
store i32 0, i32* %1
store i32 0, i32* %7
store float 0.000000e+00, float* %8
%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* %5)
%12 = load i32, i32* %3
store i32 %12, i32* %4
store i32 1, i32* %6
br label %13
13: ; preds = %39, %0
%14 = load i32, i32* %6
%15 = load i32, i32* %2
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %42
17: ; preds = %13
%18 = load i32, i32* %7
%19 = load i32, i32* %3
%20 = add nsw i32 %18, %19
store i32 %20, i32* %7
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = srem i32 %21, %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %38
25: ; preds = %17
%26 = load float, float* %8
%27 = fpext float %26 to double
%28 = fadd double %27, 2.000000e-02
%29 = fptrunc double %28 to float
store float %29, float* %8
%30 = load i32, i32* %4
%31 = sitofp i32 %30 to float
%32 = load i32, i32* %4
%33 = sitofp i32 %32 to float
%34 = load float, float* %8
%35 = fneg float %33
%36 = call float @llvm.fmuladd.f32(float %35, float %34, float %31)
%37 = fptosi float %36 to i32
store i32 %37, i32* %3
br label %38
38: ; preds = %25, %17
br label %39
39: ; preds = %38
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %13
42: ; preds = %13
%43 = load i32, i32* %7
%44 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %43)
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* %1
%11 = icmp slt i32 %10, 1
br i1 %11, label %36, label %12
12: ; preds = %0
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = sitofp i32 %13 to float
%16 = fneg float %15
br label %17
17: ; preds = %12, %31
%18 = phi float [ 0.000000e+00, %12 ], [ %33, %31 ]
%19 = phi i32 [ 0, %12 ], [ %22, %31 ]
%20 = phi i32 [ 1, %12 ], [ %34, %31 ]
%21 = phi i32 [ %13, %12 ], [ %32, %31 ]
%22 = add nsw i32 %21, %19
%23 = srem i32 %20, %14
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %17
%26 = fpext float %18 to double
%27 = fadd double %26, 2.000000e-02
%28 = fptrunc double %27 to float
%29 = call float @llvm.fmuladd.f32(float %16, float %28, float %15)
%30 = fptosi float %29 to i32
store i32 %30, i32* %2
br label %31
31: ; preds = %17, %25
%32 = phi i32 [ %30, %25 ], [ %21, %17 ]
%33 = phi float [ %28, %25 ], [ %18, %17 ]
%34 = add nuw i32 %20, 1
%35 = icmp eq i32 %20, %10
br i1 %35, label %36, label %17
36: ; preds = %31, %0
%37 = phi i32 [ 0, %0 ], [ %22, %31 ]
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %37)
ret i32 0
}