a = int(eval(input()))

x = a + a**2 + a**3

print(x)
a = int(eval(input()))

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

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

-x = a + a**2 + a**3 -print(x) +print((a + a**2 + a**3))