#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 *, long long);
int scanf(char *, long long *);
int main() {
  long long p, n;
  while (scanf("%lld", &n) == 1) {
    if (n < 0)
      break;
    else if (n >= 0 && n <= 210000000)
      p = (n * (n + 1)) / 2 + 1;
    printf("%lld\n", p);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11ad <main+0x8d>
cmpq   $0x0,-0x18(%rbp)
jge    1158 <main+0x38>
jmp    11ad <main+0x8d>
cmpq   $0x0,-0x18(%rbp)
jl     1193 <main+0x73>
cmpq   $0xc845880,-0x18(%rbp)
0c
jg     1193 <main+0x73>
mov    -0x18(%rbp),%rax
mov    -0x18(%rbp),%rcx
add    $0x1,%rcx
imul   %rcx,%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1198 <main+0x78>
mov    -0x10(%rbp),%rsi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11a0 <main+0x80>
mov    (%rsp),%rax
test   %rax,%rax
js     11a0 <main+0x80>
lea    0xeb9(%rip),%r14
lea    0xead(%rip),%r15
mov    %rsp,%r12
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rcx
lea    0x1(%rax),%rbx
imul   %rax,%rbx
shr    %rbx
add    $0x1,%rbx
cmp    $0xc845881,%rax
cmovae %rcx,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11a0 <main+0x80>
mov    (%rsp),%rax
test   %rax,%rax
jns    1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
br label %4
4: ; preds = %25, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %3)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %28
7: ; preds = %4
%8 = load i64, i64* %3
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
br label %28
11: ; preds = %7
%12 = load i64, i64* %3
%13 = icmp sge i64 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i64, i64* %3
%16 = icmp sle i64 %15, 210000000
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load i64, i64* %3
%19 = load i64, i64* %3
%20 = add nsw i64 %19, 1
%21 = mul nsw i64 %18, %20
%22 = sdiv i64 %21, 2
%23 = add nsw i64 %22, 1
store i64 %23, i64* %2
br label %24
24: ; preds = %17, %14, %11
br label %25
25: ; preds = %24
%26 = load i64, i64* %2
%27 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %26)
br label %4
28: ; preds = %10, %4
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = icmp ne i32 %3, 1
%5 = load i64, i64* %1
%6 = icmp slt i64 %5, 0
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %23, label %8
8: ; preds = %0, %8
%9 = phi i64 [ %20, %8 ], [ %5, %0 ]
%10 = phi i64 [ %16, %8 ], [ undef, %0 ]
%11 = icmp ult i64 %9, 210000001
%12 = add nuw nsw i64 %9, 1
%13 = mul nuw nsw i64 %12, %9
%14 = lshr i64 %13, 1
%15 = add nuw nsw i64 %14, 1
%16 = select i1 %11, i64 %15, i64 %10
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %16)
%18 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%19 = icmp ne i32 %18, 1
%20 = load i64, i64* %1
%21 = icmp slt i64 %20, 0
%22 = select i1 %19, i1 true, i1 %21
br i1 %22, label %23, label %8
23: ; preds = %8, %0
ret i32 0
}