while True:
    try:
        n = int(input())
        sum = int(((3 * n + 1) * n) / 2)
        print(sum)
    except:
        break