#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 num, mon, k, tot = 0, disc = 0;
  scanf("%d", &num);
  scanf("%d", &mon);
  scanf("%d", &k);
  for (int i = 0; i < num; i = i + k) {
    if (i >= k) {
      disc = disc + 0.02 * mon;
    }
    tot = k * (mon - disc) + tot;
  }
  printf("%d", tot);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cd <main+0xad>
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     11ad <main+0x8d>
cvtsi2sdl -0x18(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe62(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x18(%rbp),%ecx
imul   %ecx,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1174 <main+0x54>
mov    -0x14(%rbp),%esi
lea    0xe31(%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    0xedc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r8d
test   %r8d,%r8d
jle    11a6 <main+0x86>
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%edx
cvtsi2sd %edx,%xmm0
xor    %edi,%edi
mulsd  0xe8d(%rip),%xmm0
xor    %ebx,%ebx
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
cmp    %ecx,%edi
cmovge %eax,%ebx
mov    %edx,%eax
sub    %ebx,%eax
imul   %ecx,%eax
add    %eax,%esi
add    %ecx,%edi
cmp    %r8d,%edi
jl     1180 <main+0x60>
jmp    11a8 <main+0x88>
xor    %esi,%esi
lea    0xe59(%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
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
%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)
store i32 0, i32* %7
br label %11
11: ; preds = %34, %0
%12 = load i32, i32* %7
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %38
15: ; preds = %11
%16 = load i32, i32* %7
%17 = load i32, i32* %4
%18 = icmp sge i32 %16, %17
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = load i32, i32* %6
%21 = sitofp i32 %20 to double
%22 = load i32, i32* %3
%23 = sitofp i32 %22 to double
%24 = call double @llvm.fmuladd.f64(double 2.000000e-02, double %23, double %21)
%25 = fptosi double %24 to i32
store i32 %25, i32* %6
br label %26
26: ; preds = %19, %15
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = load i32, i32* %6
%30 = sub nsw i32 %28, %29
%31 = mul nsw i32 %27, %30
%32 = load i32, i32* %5
%33 = add nsw i32 %31, %32
store i32 %33, i32* %5
br label %34
34: ; preds = %26
%35 = load i32, i32* %7
%36 = load i32, i32* %4
%37 = add nsw i32 %35, %36
store i32 %37, i32* %7
br label %11
38: ; preds = %11
%39 = load i32, i32* %5
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %39)
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 sgt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = sitofp i32 %14 to double
br label %19
16: ; preds = %19, %0
%17 = phi i32 [ 0, %0 ], [ %30, %19 ]
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
ret i32 0
19: ; preds = %12, %19
%20 = phi i32 [ 0, %12 ], [ %31, %19 ]
%21 = phi i32 [ 0, %12 ], [ %27, %19 ]
%22 = phi i32 [ 0, %12 ], [ %30, %19 ]
%23 = icmp slt i32 %20, %13
%24 = sitofp i32 %21 to double
%25 = call double @llvm.fmuladd.f64(double %15, double 2.000000e-02, double %24)
%26 = fptosi double %25 to i32
%27 = select i1 %23, i32 %21, i32 %26
%28 = sub nsw i32 %14, %27
%29 = mul nsw i32 %28, %13
%30 = add nsw i32 %29, %22
%31 = add nsw i32 %13, %20
%32 = icmp slt i32 %31, %10
br i1 %32, label %19, label %16
}