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