a = eval(input())

b = int(a)

print((b+b**2+b**3))

a=int(eval(input()))

print((a+a**2+a**3))
a = eval(input())
b = int(a)
print((b + b**2 + b**3))

a = int(eval(input()))
print((a + a**2 + a**3))

-a = eval(input()) -b = int(a) -print((b + b**2 + b**3)) +a = int(eval(input())) +print((a + a**2 + a**3))