#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, k, m, sum = 0, x, dc;
  float otsipka = 0.00;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  dc = m;
  for (x = 0; x < n; x++) {
    if (x != 0 && x % k == 0) {
      otsipka = otsipka + 0.02;
      m = dc - (dc * otsipka);
    }
    sum = sum + m;
  }
  printf("%d", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%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    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1201 <main+0xe1>
cmpl   $0x0,-0x18(%rbp)
je     11ea <main+0xca>
mov    -0x18(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11ea <main+0xca>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4e(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
cvtsi2ssl -0x1c(%rbp),%xmm1
cvtsi2ssl -0x1c(%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,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117b <main+0x5b>
mov    -0x14(%rbp),%esi
lea    0xdfd(%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    11c4 <main+0xa4>
mov    0x4(%rsp),%esi
cmp    $0x1,%edi
je     11c6 <main+0xa6>
mov    0x8(%rsp),%r8d
cvtsi2ss %esi,%xmm0
movaps 0xe8c(%rip),%xmm1
xorps  %xmm0,%xmm1
mov    $0x1,%ecx
xorps  %xmm3,%xmm3
movsd  0xe89(%rip),%xmm2
mov    %esi,%ebx
jmp    1199 <main+0x79>
nopl   0x0(%rax,%rax,1)
add    %ebx,%esi
add    $0x1,%ecx
cmp    %ecx,%edi
je     11c6 <main+0xa6>
mov    %ecx,%eax
cltd
idiv   %r8d
test   %edx,%edx
jne    1190 <main+0x70>
cvtss2sd %xmm3,%xmm3
addsd  %xmm2,%xmm3
cvtsd2ss %xmm3,%xmm3
movaps %xmm1,%xmm4
mulss  %xmm3,%xmm4
addss  %xmm0,%xmm4
cvttss2si %xmm4,%ebx
mov    %ebx,0x4(%rsp)
jmp    1190 <main+0x70>
xor    %esi,%esi
lea    0xe4b(%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* %5
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* %4)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %4
store i32 %12, i32* %7
store i32 0, i32* %6
br label %13
13: ; preds = %42, %0
%14 = load i32, i32* %6
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %45
17: ; preds = %13
%18 = load i32, i32* %6
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %38
20: ; preds = %17
%21 = load i32, i32* %6
%22 = load i32, i32* %3
%23 = srem i32 %21, %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %38
25: ; preds = %20
%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* %7
%31 = sitofp i32 %30 to float
%32 = load i32, i32* %7
%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* %4
br label %38
38: ; preds = %25, %20, %17
%39 = load i32, i32* %5
%40 = load i32, i32* %4
%41 = add nsw i32 %39, %40
store i32 %41, i32* %5
br label %42
42: ; preds = %38
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %13
45: ; preds = %13
%46 = load i32, i32* %5
%47 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %46)
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* %3)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %37
12: ; preds = %0
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = sitofp i32 %13 to float
%16 = fneg float %15
%17 = icmp eq i32 %10, 1
br i1 %17, label %37, label %18
18: ; preds = %12, %31
%19 = phi float [ %33, %31 ], [ 0.000000e+00, %12 ]
%20 = phi i32 [ %34, %31 ], [ %13, %12 ]
%21 = phi i32 [ %35, %31 ], [ 1, %12 ]
%22 = phi i32 [ %32, %31 ], [ %13, %12 ]
%23 = srem i32 %21, %14
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %18
%26 = fpext float %19 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* %3
br label %31
31: ; preds = %25, %18
%32 = phi i32 [ %30, %25 ], [ %22, %18 ]
%33 = phi float [ %28, %25 ], [ %19, %18 ]
%34 = add nsw i32 %32, %20
%35 = add nuw nsw i32 %21, 1
%36 = icmp eq i32 %35, %10
br i1 %36, label %37, label %18
37: ; preds = %31, %12, %0
%38 = phi i32 [ 0, %0 ], [ %13, %12 ], [ %34, %31 ]
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %38)
ret i32 0
}