After a probationary period in the game development company of IT City Petya was included in a group of the programmers that develops a new turn-based strategy game resembling the well known "Heroes of Might & Magic". A part of the game is turn-based fights of big squadrons of enemies on infinite fields where every cell is in form of a hexagon.

Some of magic effects are able to affect several field cells at once, cells that are situated not farther than n cells away from the cell in which the effect was applied. The distance between cells is the minimum number of cell border crosses on a path from one cell to another.

It is easy to see that the number of cells affected by a magic effect grows rapidly when n increases, so it can adversely affect the game performance. That's why Petya decided to write a program that can, given n, determine the number of cells that should be repainted after effect application, so that game designers can balance scale of the effects and the game performance. Help him to do it. Find the number of hexagons situated not farther than n cells away from a given cell. [Image] 


-----Input-----

The only line of the input contains one integer n (0 ≤ n ≤ 10^9).


-----Output-----

Output one integer — the number of hexagons situated not farther than n cells away from a given cell.


-----Examples-----
Input
2

Output
19

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
n = int(input())
ans = 3 * n * (n + 1) + 1
print(str(ans))


n = int(input())
print(1 + (n * n + n) * 3)


n = int(input())
if n == 0:
	print(1)
elif n == 1:
	print(7)
else:
	k = n * (n + 1) // 2 - 1
	print(k * 6 + 7)


a = int(input())
print(1 + 3 * a * (a + 1))


n = int(input())
print((6 + n * 6) * n // 2 + 1)


from decimal import *
n = Decimal(input())
print(int((0 + n * 6) * (n + 1) / 2 + 1 + 1 - 1))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	print(6 * (n * (n + 1) // 2) + 1)
testcase(1)


import sys
mod = int(1000000000.0) + 7
inf = int(10000000000.0)
n = int(input())
print(3 * n * (n + 1) + 1)


from itertools import combinations, accumulate, groupby, count
from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from os import *
from re import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (fast, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer, end='\n'):
	stdout.write(str(answer) + end)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
n = int(z())
ans = 6 * (n * (n + 1) // 2)
print(int(ans) + 1)


n = int(input())
if n == 0:
	print(1)
else:
	print(n * (6 + 3 * (n - 1)) + 1)


n = int(input())
a1 = 6
an = 6 + (n - 1) * 6
s = (a1 + an) * n // 2 + 1
print(s)


import re, sys, string, operator, functools, fractions, collections
sys.setrecursionlimit(10 ** 7)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
RI = lambda x=' ': list(map(int, input().split(x)))
RS = lambda x=' ': input().rstrip().split(x)
mod = int(1000000000.0 + 7)
eps = 1e-06
n = RI()[0]
print(3 * n * (n + 1) + 1)


def main():
	n = int(input())
	print(solver(n))

def solver(n):
	return 3 * n * (n + 1) + 1
main()


n = int(input())
sum = int()
if n == 0:
	print(1)
elif n == 1:
	print(7)
else:
	print(int((12 + 6 * (n - 1)) / 2) * n + 1)


x = input()
print(3 * int(x) * (int(x) + 1) + 1)


import math
n = int(input())
print(int(3 * n * (n + 1) + 1))


import collections, itertools, functools, math

def solve():
	n = int(input())
	return 1 + 6 * n * (n + 1) // 2
print(solve())


dist = int(input())
nTiles = 1 + dist * (dist + 1) * 3
print(nTiles)


import sys
import datetime

def main():
	n = int(input()) + 1
	ans = 3 * (n - 1) * n + 1
	print(ans)
main()


a = int(input())
print(6 * (a + 1) * a // 2 + 1)


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
import decimal

def fun():
	n = ii1()
	if n == 0:
		print(1)
	elif n == 1:
		print(7)
	else:
		n += 1
		ans = 1
		ans += (n - 1) * (3 * n)
		print(ans)
fun()


n = int(input())
print(1 if n == 0 else 1 + (n + 1) * 6 * n // 2)


n = int(input())
a = 6
l = 6 * n
print(int(n * ((a + l) // 2) + 1))


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	n = int(input())
	print(1 + 6 * (n * (n + 1) // 2))
for _ in range(1):
	solve()


def main():
	n = int(input())
	print(n * (n + 1) * 3 + 1)
main()


def __starting_point():
	n = int(input())
	if n == 0:
		print(1)
	else:
		print(1 + 3 * n * (n + 1))
__starting_point()


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = ii1()
res = 0
if n >= 2:
	res = n * (6 + 6 * n) // 2
elif n >= 1:
	res = 6
print(res + 1)


def cal(n):
	l = n * (n + 1) // 2 * 6 + 1
	return l
n = int(input())
m = cal(n)
print(m)


k = int(input())
print(3 * k * (k + 1) + 1)


n = int(input())
if n == 0:
	print('1')
	exit(0)
i = 1 + 3 * n * (n + 1)
print(i)


n = int(input())
if n == 0:
	print(1)
else:
	S = (12 + 6 * (n - 1)) // 2 * n
	print(S + 1)


import os, sys, pdb
import time, calendar, datetime
import math, itertools
import operator as op
from functools import reduce

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom
(n,) = list(map(int, input().split()))
print(3 * n * (n + 1) + 1)


n = int(input())
result1 = n + 1
result2 = n * result1 // 2
result = result2 * 6 + 1
print(result)


n = int(input())
d = 0
c = d + n * 6
s = (c + d) * ((c - d) // 6 + 1) // 2 + 1
print(s)


n = int(input())
res = 1
res += (12 + 6 * (n - 1)) * n // 2
print(res)


from collections import defaultdict
n = int(input())
r = 1 + 3 * (n * (n + 1))
print(r)


n = int(input())

def value(n):
	return 3 * n * (n + 1) + 1
print(value(n))


n = int(input())
m = (n + 1) * (n + 2) - 1 + 2 * (n * n)
print(int(m))


import math
n = int(input())
res = 6 * (pow(n, 2) + n) // 2
res1 = res + 1
print(res1)


n = int(input())
som = n * (n + 1) // 2
res = som * 6 + 1
print(res)


distance = int(input())
result = float()
result = distance * (distance + 1) * 3 + 1
print(int(result))


t = int(input())
print(1 + 3 * t * (t + 1))


n = int(input())
t = 3 * n
y = n + 1
a = t * y
print(1 + a)


from sys import stdin, stderr

def readInts():
	return map(int, stdin.readline().strip().split())

def print_err(*args, **kwargs):
	print(*args, file=stderr, **kwargs)

def solve(n):
	if n == 0:
		return 1
	s = 1
	return 3 * n * (n + 1) + 1

def run():
	(n,) = readInts()
	print(solve(n))
run()


N = int(input())
ans = 1
add = 6
ans += 6 * ((N + 1) * N // 2)
print(ans)


def solve(n: int):
	return 3 * n * (n + 1) + 1

def main():
	n = int(input())
	print(solve(n))
main()


t = int(input())
z = t * (t + 1)
z = z // 2
z *= 6
z += 1
print(z)


from sys import stdin
n = int(stdin.readline()) + 1
print(3 * n * (n - 1) + 1)


def iter_pow(x, n):
	res = 1
	while n:
		if n & 1:
			res = res * x
		x = x * x
		n = n >> 1
	return res
n = int(input()) + 1
print(3 * n * n - 3 * n + 1)


N = int(input())
print(6 * (N * (N + 1)) // 2 + 1)


q = int(input())
print(3 * q * (q + 1) + 1)


a = int(input())
if a == 0:
	print(1)
elif a % 2 == 0:
	print(1 + 6 * ((a + 1) * (a // 2)))
else:
	print(1 + 6 * (a * (a // 2 + 1)))


def f(n):
	return n * (n + 1) * 3 + 1
n = int(input())
print(f(n))


n = int(input())
n += 1
p = n * (n - 1) // 2
pr = 1 + 6 * p
print(int(pr))


n = int(input())
b = 2
t = n * (3 + 3 * n) + 1
print(t)


import sys
x = int(input())
multiplication = 3 * x
if x == 0:
	print(1)
	sys.exit()
if x == 1:
	print(7)
while x > 1:
	multiplication += 3
	print(x * multiplication + 1)
	break


from math import *
n = int(input())
ans = 3 * n * (n + 1) + 1
print(str(ans))


n = int(input())
sum = n * (n + 1) // 2
ans = sum * 6 + 1
print(ans)


import io
import sys
n = int(sys.stdin.readline().strip())
print(int(1 + 3 * ((n + 1) * n)))


n = int(input())
s = 0
s = n * (n + 1) // 2
print(6 * s + 1)


from decimal import *
n = Decimal(input())
print(Decimal(6 * (n * (n + 1)) / 2 + 1))


from sys import stdin, stdout
from gc import disable

def main() -> int:
	disable()
	n = int(stdin.readline())
	ans = 6 * (2 + (n - 1)) * n // 2 + 1
	stdout.write('%i' % ans)
	return 0
main()


n = int(input())
cnt = int(0)
print(int(3 * (n + 1) * n + 1))


print((lambda x: 6 * (x * (x + 1) // 2) + 1)(int(input())))


import sys
n = int(input())
an = 6 + 6 * (n - 1)
print((6 + an) * n // 2 + 1)


n = int(input())
if n == 0:
	print(1)
else:
	a1 = 6
	d = 6
	sum = (a1 + a1 + d * (n - 1)) * n // 2
	print(sum + 1)


j = int(input())
print(1 + (j + 1) * j * 3)


A = int(input())
if A % 2 == 0:
	print(A // 2 * (A + 1) * 6 + 1)
else:
	print((A // 2 * (A + 1) + (A // 2 + 1)) * 6 + 1)


n = int(input())
s1 = 2 * ((n + 1) * (n + 2) // 2 - 1)
s2 = 2 * n * n
print(s1 + s2 + 1)


N = int(input())
print(3 * N * (N + 1) + 1)


ans = 1
n = int(input())
if 0 < n:
	n = n * (n + 1) // 2
	ans += n * 6
print(ans)


n = int(input())
if n == 1:
	print(7)
elif n == 0:
	print(1)
else:
	print(int(1 + 3 * n * (n + 1)))


import time
n = int(input())
start = time.time()
print(1 + 3 * (n + 1) * n)
finish = time.time()


c = 0
n = int(input())
print(6 * (n * (n + 1) // 2) + 1)


def s(n):
	a1 = 0
	n += 1
	d = 6
	an = a1 + d * (n - 1)
	return (a1 + an) // 2 * n
print(s(int(input())) + 1)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mod = 1000000007
for i in range(1):
	n = ii()
	ans = 1
	c = n * (n + 1)
	c //= 2
	c *= 6
	print(ans + c)


n = int(input())
rz = (12 + 6 * (n - 1)) * n // 2 + 1
print(rz)


n = int(input())
a = 6 * n
ans = 1 + (6 + a) // 2 * n
print(ans)


def equation(n):
	return 1 + 3 * n * (n + 1)
print(equation(int(input())))