s = int(input())

print(s + s ** 2 + s ** 3)















s = input()

s = int(s)



print(s + s ** 2 + s ** 3)

s = int(input())
print(s + s**2 + s**3)

s = input()
s = int(s)
print(s + s**2 + s**3)

-s = int(input()) +s = input() +s = int(s)