#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 i, n, money, k, total, discount = 0;
  total = 0;
  scanf("%d", &n);
  scanf("%d", &money);
  scanf("%d", &k);
  for (i = 0; i < n; i = i + k) {
    if (i >= k) {
      discount = discount + 0.02 * money;
    }
    total = k * (money - discount) + total;
  }
  printf("%d", total);
  return 0;
}


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