<image>

Input

The input contains a single integer a (1 ≤ a ≤ 18257).

Output

Print a single integer output (1 ≤ output ≤ 2·109).

Examples

Input

2


Output

13
## DATA SOURCE (1 for file, 0 for std input)
opt = 0
src = opt and open("input", "r") or None

def gvals(source, format = int, separator = ' '):
	if source:
		a = map(format, source.readline().split(separator))
	else:
		a = map(format, raw_input().split(separator))
	return a

def gval(source, format = int):
	if source:
		a = format(source.readline())
	else:
		a = format(raw_input())
	return a

a = gval(src)
t = [6*(x) for x in range(a)]
t[0]=1
print sum(t)+6*sum(range(a))
