def main():

    a = int(eval(input()))

    print((int(a+a*a+a**3)))



if __name__ == "__main__":

    main()
a = int(eval(input()))

print((a*(a*a+a+1)))
def main():
    a = int(eval(input()))
    print((int(a + a * a + a**3)))


if __name__ == "__main__":
    main()

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

-def main(): -    a = int(eval(input())) -    print((int(a + a * a + a**3))) - - -if __name__ == "__main__": -    main() +a = int(eval(input())) +print((a * (a * a + a + 1)))