#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 /*<<< orphan*/ scanf(char *, long long *);
int main() {
  long long int i, j, c, len, n, temp, t, res;
  while (1) {
    scanf("%lld", &n);
    if (n == 0)
      break;
    else
      printf("%lld\n", (n * (n + 1) * (n * 2 + 1)) / 6);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x30(%rbp)
jne    114f <main+0x2f>
jmp    118d <main+0x6d>
mov    -0x30(%rbp),%rax
mov    -0x30(%rbp),%rcx
add    $0x1,%rcx
imul   %rcx,%rax
mov    -0x30(%rbp),%rcx
shl    $0x1,%rcx
add    $0x1,%rcx
imul   %rcx,%rax
mov    $0x6,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x50,%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>
mov    (%rsp),%rax
test   %rax,%rax
je     119c <main+0x7c>
movabs $0x2aaaaaaaaaaaaaab,%r12
aa aa 2a
lea    0xeb4(%rip),%r14
lea    0xea8(%rip),%r15
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
lea    0x1(%rax),%rcx
imul   %rax,%rcx
add    %rax,%rax
add    $0x1,%rax
imul   %rcx,%rax
imul   %r12
mov    %rdx,%rsi
shr    $0x3f,%rsi
add    %rdx,%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rax
test   %rax,%rax
jne    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
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i32 0, i32* %1
br label %10
10: ; preds = %0, %26
%11 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %6)
%12 = load i64, i64* %6
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
br label %27
15: ; preds = %10
%16 = load i64, i64* %6
%17 = load i64, i64* %6
%18 = add nsw i64 %17, 1
%19 = mul nsw i64 %16, %18
%20 = load i64, i64* %6
%21 = mul nsw i64 %20, 2
%22 = add nsw i64 %21, 1
%23 = mul nsw i64 %19, %22
%24 = sdiv i64 %23, 6
%25 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %24)
br label %26
26: ; preds = %15
br label %10
27: ; preds = %14
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 = load i64, i64* %1
%5 = icmp eq i64 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %0, %6
%7 = phi i64 [ %16, %6 ], [ %4, %0 ]
%8 = add nsw i64 %7, 1
%9 = mul nsw i64 %8, %7
%10 = shl nsw i64 %7, 1
%11 = or i64 %10, 1
%12 = mul nsw i64 %9, %11
%13 = sdiv i64 %12, 6
%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 = load i64, i64* %1
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %6
18: ; preds = %6, %0
ret i32 0
}