K = int(input()) A = 2*K+1 B = 2*K-1 ans = A * K + B * (K-1) + A print(ans)