<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 triangle(n):
    return n*(n+1)//2
def hexagon(n):
    return 6*triangle(n) - 6*n + 1
n = int(input())
print(2*triangle(3*n - 2) - hexagon(n))