#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 n, last, total;
  while (scanf("%lld", &n) == 1) {
    last = (n * (n + 1)) / 2 + n / 2;
    total = 3 * last - 6;
    printf("%lld\n", total);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11a4 <main+0x84>
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    $0x1,%rcx
imul   %rcx,%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
imul   $0x3,-0x18(%rbp),%rax
sub    $0x6,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x30,%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    11aa <main+0x8a>
lea    0xebf(%rip),%r14
lea    0xeb3(%rip),%r15
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%rax
lea    0x1(%rax),%rcx
imul   %rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
add    %rcx,%rdx
sar    %rdx
mov    %rax,%rcx
shr    $0x3f,%rcx
add    %rax,%rcx
sar    %rcx
add    %rdx,%rcx
lea    (%rcx,%rcx,2),%rsi
add    $0xfffffffffffffffa,%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     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
%4 = alloca i64
store i32 0, i32* %1
br label %5
5: ; preds = %8, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i64, i64* %2
%10 = load i64, i64* %2
%11 = add nsw i64 %10, 1
%12 = mul nsw i64 %9, %11
%13 = sdiv i64 %12, 2
%14 = load i64, i64* %2
%15 = sdiv i64 %14, 2
%16 = add nsw i64 %13, %15
store i64 %16, i64* %3
%17 = load i64, i64* %3
%18 = mul nsw i64 3, %17
%19 = sub nsw i64 %18, 6
store i64 %19, i64* %4
%20 = load i64, i64* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %20)
br label %5
22: ; preds = %5
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 eq i32 %3, 1
br i1 %4, label %5, label %17
5: ; preds = %0, %5
%6 = load i64, i64* %1
%7 = add nsw i64 %6, 1
%8 = mul nsw i64 %7, %6
%9 = sdiv i64 %8, 2
%10 = sdiv i64 %6, 2
%11 = add nsw i64 %9, %10
%12 = mul nsw i64 %11, 3
%13 = add nsw 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 = icmp eq i32 %15, 1
br i1 %16, label %5, label %17
17: ; preds = %5, %0
ret i32 0
}