while True:
    try:
        s=int(input())
        w=3*s+2
        L=range(2,w,3)
        print(sum(L))
    except:
        break