<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
from __future__ import division

def read(func=None):
    return func(raw_input()) if func else raw_input()

################################

a = read(int)

def solve(a):
    if a == 1:
        return 1
    if a == 2:
        return 13
    prev1 = 3
    prev2 = 1
    total = 13
    for i in xrange(3, a + 1):
        prev1 += 2
        prev2 += 2
        total += (prev1 + prev2) * 3
    return total

print solve(a)