<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
def calc(n):
	return (1+n)*n/2
n=int(raw_input())
p=1
q=0
for i in range(n-1):
	p+=3
	q+=1
print calc(p)+calc(q)*3