N = 10**7



M = 10**5

arr = list(range(M))

for i in range(N):

    t = arr[i % M]



# 答え

a = int(eval(input()))

print((a + a**2 + a**3))

N = 10**7



arr = [0]

for i in range(N):

    t = arr[0]



# 答え

a = int(eval(input()))

print((a + a**2 + a**3))

N = 10**7
M = 10**5
arr = list(range(M))
for i in range(N):
    t = arr[i % M]
# 答え
a = int(eval(input()))
print((a + a**2 + a**3))

N = 10**7
arr = [0]
for i in range(N):
    t = arr[0]
# 答え
a = int(eval(input()))
print((a + a**2 + a**3))

-M = 10**5 -arr = list(range(M)) +arr = [0] -    t = arr[i % M] +    t = arr[0]