#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 *, float);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int n;
  float m;
  int k;
  float a;
  float c = 0.02;
  float sum;
  scanf("%d", &n);
  scanf("%f", &m);
  scanf("%d", &k);
  sum = m * k;
  n = n - k;
  a = m * c;
  while ((n - k) >= 0) {
    m = m - a;
    sum = sum + k * m;
    n = n - k;
  }
  if (n != 0) {
    a = n * (m - a);
    sum = sum + a;
  }
  printf("%.0f", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb2(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
cmp    $0x0,%eax
jl     11e5 <main+0xc5>
movss  -0xc(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x1c(%rbp),%xmm1
cvtsi2ssl -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    119d <main+0x7d>
cmpl   $0x0,-0x8(%rbp)
je     1216 <main+0xf6>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
subss  -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
lea    0xde8(%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    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
cvtsi2ss %ecx,%xmm3
movss  0x8(%rsp),%xmm1
movaps %xmm1,%xmm0
mulss  %xmm3,%xmm0
mov    0x4(%rsp),%eax
sub    %ecx,%eax
mov    %eax,0x4(%rsp)
movss  0xe7c(%rip),%xmm2
mulss  %xmm1,%xmm2
cmp    %ecx,%eax
jl     11af <main+0x8f>
nopl   0x0(%rax)
subss  %xmm2,%xmm1
movaps %xmm3,%xmm4
mulss  %xmm1,%xmm4
addss  %xmm4,%xmm0
sub    %ecx,%eax
cmp    %ecx,%eax
jge    1190 <main+0x70>
movss  %xmm1,0x8(%rsp)
mov    %eax,0x4(%rsp)
test   %eax,%eax
je     11c4 <main+0xa4>
xorps  %xmm3,%xmm3
cvtsi2ss %eax,%xmm3
subss  %xmm2,%xmm1
mulss  %xmm3,%xmm1
jmp    11cc <main+0xac>
movss  0xe38(%rip),%xmm1
addss  %xmm1,%xmm0
lea    0xe37(%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 = [3 x i8] c"%f\00"
@.str.2 = [5 x i8] c"%.0f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store float 0x3F947AE140000000, float* %6
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%11 = load float, float* %3
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to float
%14 = fmul float %11, %13
store float %14, float* %7
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = sub nsw i32 %15, %16
store i32 %17, i32* %2
%18 = load float, float* %3
%19 = load float, float* %6
%20 = fmul float %18, %19
store float %20, float* %5
br label %21
21: ; preds = %26, %0
%22 = load i32, i32* %2
%23 = load i32, i32* %4
%24 = sub nsw i32 %22, %23
%25 = icmp sge i32 %24, 0
br i1 %25, label %26, label %38
26: ; preds = %21
%27 = load float, float* %3
%28 = load float, float* %5
%29 = fsub float %27, %28
store float %29, float* %3
%30 = load float, float* %7
%31 = load i32, i32* %4
%32 = sitofp i32 %31 to float
%33 = load float, float* %3
%34 = call float @llvm.fmuladd.f32(float %32, float %33, float %30)
store float %34, float* %7
%35 = load i32, i32* %2
%36 = load i32, i32* %4
%37 = sub nsw i32 %35, %36
store i32 %37, i32* %2
br label %21
38: ; preds = %21
%39 = load i32, i32* %2
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = load i32, i32* %2
%43 = sitofp i32 %42 to float
%44 = load float, float* %3
%45 = load float, float* %5
%46 = fsub float %44, %45
%47 = fmul float %43, %46
store float %47, float* %5
%48 = load float, float* %7
%49 = load float, float* %5
%50 = fadd float %48, %49
store float %50, float* %7
br label %51
51: ; preds = %41, %38
%52 = load float, float* %7
%53 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), float %52)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [5 x i8] c"%.0f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load float, float* %2
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
%13 = fmul float %10, %12
%14 = load i32, i32* %1
%15 = sub nsw i32 %14, %11
store i32 %15, i32* %1
%16 = fmul float %10, 0x3F947AE140000000
%17 = icmp slt i32 %15, %11
br i1 %17, label %27, label %18
18: ; preds = %0, %18
%19 = phi float [ %23, %18 ], [ %13, %0 ]
%20 = phi i32 [ %24, %18 ], [ %15, %0 ]
%21 = phi float [ %22, %18 ], [ %10, %0 ]
%22 = fsub float %21, %16
%23 = call float @llvm.fmuladd.f32(float %12, float %22, float %19)
%24 = sub nsw i32 %20, %11
%25 = icmp slt i32 %24, %11
br i1 %25, label %26, label %18
26: ; preds = %18
store float %22, float* %2
store i32 %24, i32* %1
br label %27
27: ; preds = %26, %0
%28 = phi float [ %22, %26 ], [ %10, %0 ]
%29 = phi i32 [ %24, %26 ], [ %15, %0 ]
%30 = phi float [ %23, %26 ], [ %13, %0 ]
%31 = icmp eq i32 %29, 0
%32 = sitofp i32 %29 to float
%33 = fsub float %28, %16
%34 = fmul float %33, %32
%35 = select i1 %31, float -0.000000e+00, float %34
%36 = fadd float %30, %35
%37 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), float %36)
ret i32 0
}