#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 *, int *);
int main(int argc, char *argv[]) {
  int k, n, w;
  int i, sum = 0;
  int borrow = 0;
  scanf("%d %d %d", &k, &n, &w);
  for (i = 1; i <= w; i++) {
    sum += i * k;
  }
  if (n - sum > 0)
    printf("%d\n", 0);
  else {
    printf("%d\n", (n - sum) * (-1));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1040 <scanf@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     118a <main+0x6a>
mov    -0x20(%rbp),%eax
imul   -0x14(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1163 <main+0x43>
mov    -0x18(%rbp),%eax
sub    -0x24(%rbp),%eax
cmp    $0x0,%eax
jle    11ac <main+0x8c>
lea    0xe69(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
jmp    11c1 <main+0xa1>
mov    -0x18(%rbp),%eax
sub    -0x24(%rbp),%eax
imul   $0xffffffff,%eax,%esi
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
xor    %eax,%eax
mov    $0x0,%edx
test   %ecx,%ecx
jle    1166 <main+0x46>
lea    -0x1(%rcx),%edx
lea    -0x2(%rcx),%esi
imul   %rdx,%rsi
shr    %rsi
lea    (%rsi,%rcx,2),%edx
add    $0xffffffff,%edx
imul   0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
sub    %edx,%ecx
mov    %ecx,%esi
neg    %esi
test   %ecx,%ecx
cmovg  %eax,%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
store i32 0, i32* %11
%12 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %7, i32* %8)
store i32 1, i32* %9
br label %13
13: ; preds = %23, %2
%14 = load i32, i32* %9
%15 = load i32, i32* %8
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = load i32, i32* %9
%19 = load i32, i32* %6
%20 = mul nsw i32 %18, %19
%21 = load i32, i32* %10
%22 = add nsw i32 %21, %20
store i32 %22, i32* %10
br label %23
23: ; preds = %17
%24 = load i32, i32* %9
%25 = add nsw i32 %24, 1
store i32 %25, i32* %9
br label %13
26: ; preds = %13
%27 = load i32, i32* %7
%28 = load i32, i32* %10
%29 = sub nsw i32 %27, %28
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
br label %39
33: ; preds = %26
%34 = load i32, i32* %7
%35 = load i32, i32* %10
%36 = sub nsw i32 %34, %35
%37 = mul nsw i32 %36, -1
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %33, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 1
br i1 %11, label %25, label %12
12: ; preds = %2
%13 = load i32, i32* %3
%14 = shl nuw i32 %10, 1
%15 = add nsw i32 %10, -1
%16 = zext i32 %15 to i33
%17 = add nsw i32 %10, -2
%18 = zext i32 %17 to i33
%19 = mul i33 %16, %18
%20 = lshr i33 %19, 1
%21 = trunc i33 %20 to i32
%22 = add i32 %14, %21
%23 = add i32 %22, -1
%24 = mul i32 %13, %23
br label %25
25: ; preds = %12, %2
%26 = phi i32 [ 0, %2 ], [ %24, %12 ]
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, %26
%29 = icmp sgt i32 %28, 0
%30 = sub nsw i32 0, %28
%31 = select i1 %29, i32 0, i32 %30
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %31)
ret i32 0
}