<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
#star noumber problem
# 1 13....

n=int(input())
k=6*n;k1=n-1;ans=k*k1
print(ans+1)
