a = int(eval(input()))

b = a**2

c = a**3



print((a+b+c))
a = int(eval(input()))

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

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

-b = a**2 -c = a**3 -print((a + b + c)) +print((a + a**2 + a**3))