#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 */
scalar_t__ EOF;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, long long);
scalar_t__ scanf(char *, long long *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int i;
  long long n;
  fflush(stdin);
  while (scanf("%lld", &n) != EOF) {
    if (n <= 1 || n >= 1000000000)
      return 1;
    long long row = 0, final = 0;
    for (i = 1; i <= n; i += 2)
      row += i;
    final = row * 2 - 1;
    printf("%d\n", final * 3 - 6);
  }
  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)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xea5(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e75(%rip),%rcx
cmp    (%rcx),%rax
je     1202 <main+0xd2>
cmpq   $0x1,-0x20(%rbp)
jle    118d <main+0x5d>
cmpq   $0x3b9aca00,-0x20(%rbp)
3b
jl     1199 <main+0x69>
movl   $0x1,-0x4(%rbp)
jmp    1209 <main+0xd9>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x1,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x20(%rbp),%rax
jg     11d8 <main+0xa8>
movslq -0x14(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    11b0 <main+0x80>
mov    -0x28(%rbp),%rax
shl    $0x1,%rax
sub    $0x1,%rax
mov    %rax,-0x30(%rbp)
imul   $0x3,-0x30(%rbp),%rsi
sub    $0x6,%rsi
lea    0xe0d(%rip),%rdi
call   1030 <printf@plt>
jmp    1154 <main+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xeaf(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e7e(%rip),%rbp
xor    %r14d,%r14d
cmp    0x0(%rbp),%rax
je     11dc <main+0xac>
lea    0xe93(%rip),%r15
lea    0xe87(%rip),%r12
lea    0x8(%rsp),%rbx
xchg   %ax,%ax
mov    0x8(%rsp),%rax
lea    -0x3b9aca00(%rax),%rcx
cmp    $0xffffffffc4653602,%rcx
jb     11d6 <main+0xa6>
add    $0xffffffffffffffff,%rax
shr    %rax
lea    (%rax,%rax,2),%rcx
lea    -0x1(%rax),%rdx
imul   %rax,%rdx
and    $0xfffffffffffffffe,%rdx
add    %rcx,%rdx
lea    (%rdx,%rdx,2),%rax
lea    (%rax,%rax,1),%rsi
add    $0xfffffffffffffffd,%rsi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmp    0x0(%rbp),%rax
jne    1180 <main+0x50>
jmp    11dc <main+0xac>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [5 x i8] c"%lld\00"
@EOF = global i64 0
@.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 i64
%8 = alloca i64
%9 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* @stdin
%11 = call i32 @fflush(i32 %10)
br label %12
12: ; preds = %37, %2
%13 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %7)
%14 = load i64, i64* @EOF
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %45
16: ; preds = %12
%17 = load i64, i64* %7
%18 = icmp sle i64 %17, 1
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i64, i64* %7
%21 = icmp sge i64 %20, 1000000000
br i1 %21, label %22, label %23
22: ; preds = %19, %16
store i32 1, i32* %3
br label %46
23: ; preds = %19
store i64 0, i64* %8
store i64 0, i64* %9
store i32 1, i32* %6
br label %24
24: ; preds = %34, %23
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = load i64, i64* %7
%28 = icmp sle i64 %26, %27
br i1 %28, label %29, label %37
29: ; preds = %24
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = load i64, i64* %8
%33 = add nsw i64 %32, %31
store i64 %33, i64* %8
br label %34
34: ; preds = %29
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 2
store i32 %36, i32* %6
br label %24
37: ; preds = %24
%38 = load i64, i64* %8
%39 = mul nsw i64 %38, 2
%40 = sub nsw i64 %39, 1
store i64 %40, i64* %9
%41 = load i64, i64* %9
%42 = mul nsw i64 %41, 3
%43 = sub nsw i64 %42, 6
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %43)
br label %12
45: ; preds = %12
store i32 0, i32* %3
br label %46
46: ; preds = %45, %22
%47 = load i32, i32* %3
ret i32 %47
}

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