def main():

    N = int(eval(input()))

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





if __name__ == '__main__':

    main()



# import sys

# input = sys.stdin.readline

# 

# sys.setrecursionlimit(10 ** 7)

# 

# (int(x)-1 for x in input().split())

# rstrip()

#

# def binary_search(*, ok, ng, func):

#     while abs(ok - ng) > 1:

#         mid = (ok + ng) // 2

#         if func(mid):

#             ok = mid

#         else:

#             ng = mid

#     return ok

def main():

    a = int(eval(input()))

    ret = a

    ret += a * a

    ret += a * a * a

    print(ret)





if __name__ == '__main__':

    main()

def main():
    N = int(eval(input()))
    print((N + N * N + N * N * N))


if __name__ == "__main__":
    main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

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


if __name__ == "__main__":
    main()

-    N = int(eval(input())) -    print((N + N * N + N * N * N)) +    a = int(eval(input())) +    ret = a +    ret += a * a +    ret += a * a * a +    print(ret) -# import sys -# input = sys.stdin.readline -# -# sys.setrecursionlimit(10 ** 7) -# -# (int(x)-1 for x in input().split()) -# rstrip() -# -# def binary_search(*, ok, ng, func): -#     while abs(ok - ng) > 1: -#         mid = (ok + ng) // 2 -#         if func(mid): -#             ok = mid -#         else: -#             ng = mid -#     return ok