K = int(input()) print((2*K+1)*(2*K+1)-4*K+1)