a = int(eval(input()))

result = a + a * a + a * a * a

print(result)
#!/usr/bin/env python

# -*- coding: utf-8 -*-



a = int(eval(input()))

result = a + a ** 2 + a ** 3



print(result)

a = int(eval(input()))
result = a + a * a + a * a * a
print(result)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
a = int(eval(input()))
result = a + a**2 + a**3
print(result)

+#!/usr/bin/env python +# -*- coding: utf-8 -*- -result = a + a * a + a * a * a +result = a + a**2 + a**3