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