<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
'''
Created on Apr 22, 2013

@author: ola
'''

def ps(x):
    total = 1
    while x > 1:
        total += (2*x - 1)*6 - 6
        x = x - 1
    return total

def solve():
    line = raw_input()
    data = line.split()
    x = int(data[0])
    if x == 1:
        print 1
    else:
        print ps(x)

if __name__ == '__main__':
    solve()