N = 10**7



M = 10**5

arr = list(range(M))





def f(x):

    return x





for i in range(N):

    b = arr[i % M]

    b = f(b)



a = int(eval(input()))

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

N = 10**7



# M = 10**5

# arr = list(range(M))





# def f(x):

#     return x





for i in range(N):

    pass



# 答え

a = int(eval(input()))

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

N = 10**7
M = 10**5
arr = list(range(M))


def f(x):
    return x


for i in range(N):
    b = arr[i % M]
    b = f(b)
a = int(eval(input()))
print((a + a**2 + a**3))

N = 10**7
# M = 10**5
# arr = list(range(M))
# def f(x):
#     return x
for i in range(N):
    pass
# 答え
a = int(eval(input()))
print((a + a**2 + a**3))

-M = 10**5 -arr = list(range(M)) - - -def f(x): -    return x - - +# M = 10**5 +# arr = list(range(M)) +# def f(x): +#     return x -    b = arr[i % M] -    b = f(b) +    pass +# 答え