#!/usr/bin python3

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



def main():

    N = int(eval(input()))



    print((N+N*N+N*N*N))



if __name__ == '__main__':

    main()
#!/usr/bin python3

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



def main():

    a = int(eval(input()))



    print((a+a*a+a*a*a))



if __name__ == '__main__':

    main()
#!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
    N = int(eval(input()))
    print((N + N * N + N * N * N))


if __name__ == "__main__":
    main()

#!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
    a = int(eval(input()))
    print((a + a * a + a * a * a))


if __name__ == "__main__":
    main()

-    N = int(eval(input())) -    print((N + N * N + N * N * N)) +    a = int(eval(input())) +    print((a + a * a + a * a * a))