n = int(input())
sum_num = (1+3*n)*(n)/2
print(int(sum_num))