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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    118f <main+0x6f>
cmpq   $0x0,-0x10(%rbp)
jge    1158 <main+0x38>
jmp    118f <main+0x6f>
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    $0x1,%rcx
imul   %rcx,%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe80(%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   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    119b <main+0x7b>
mov    0x8(%rsp),%rax
test   %rax,%rax
js     119b <main+0x7b>
lea    0xeb5(%rip),%r14
lea    0xea9(%rip),%r15
lea    0x8(%rsp),%rbx
nopl   0x0(%rax)
lea    0x1(%rax),%rcx
imul   %rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
add    %rcx,%rsi
sar    %rsi
add    $0x1,%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    119b <main+0x7b>
mov    0x8(%rsp),%rax
test   %rax,%rax
jns    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
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 = %20, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = load i64, i64* %2
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
br label %21
11: ; preds = %7
%12 = load i64, i64* %2
%13 = load i64, i64* %2
%14 = add nsw i64 %13, 1
%15 = mul nsw i64 %12, %14
%16 = sdiv i64 %15, 2
%17 = add nsw i64 1, %16
store i64 %17, i64* %3
%18 = load i64, i64* %3
%19 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %18)
br label %20
20: ; preds = %11
br label %4
21: ; 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 %20, label %8
8: ; preds = %0, %8
%9 = phi i64 [ %17, %8 ], [ %5, %0 ]
%10 = add nuw nsw i64 %9, 1
%11 = mul nsw i64 %10, %9
%12 = sdiv i64 %11, 2
%13 = add nsw i64 %12, 1
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %13)
%15 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%16 = icmp ne i32 %15, 1
%17 = load i64, i64* %1
%18 = icmp slt i64 %17, 0
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %20, label %8
20: ; preds = %8, %0
ret i32 0
}