Problem:
Score : 100 points

Problem Statement

Given an integer a as input, print the value a + a^2 + a^3.

Constraints

1 \leq a \leq 10

a is an integer.

Input

Input is given from Standard Input in the following format:

a

Output

Print the value a + a^2 + a^3 as an integer.

Sample Input 1

2

Sample Output 1

14

When a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.

Print the answer as an input. Outputs such as 14.0 will be judged as incorrect.

Sample Input 2

10

Sample Output 2

1110

Solution in C# (.NET Core 3.1.201) (judge verdict: Runtime Error)

using System;
using static System.Console;
using static System.Math;
using System.Numerics;
using System.Collections.Generic;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var s = ReadLine().Split(' ');
            long n, m, k;
            long ans;
            n = long.Parse(s[0]);
            m = long.Parse(s[1]);
            k = long.Parse(s[2]);
            var a = ReadLine().Split(' ');
            var b = ReadLine().Split(' ');
            long[] A = new long[n];
            long[] B = new long[m];
            for (int i = 0; i < n; i++)
            {
                A[i] = long.Parse(a[i]);
            }
            for (int i = 0; i < m; i++)
            {
                B[i] = long.Parse(b[i]);
            }

            long ai = 0;
            long aCount = maxCount(A, k);
            if (aCount == 0)
            { ans = maxCount(B, k); }
            else
            {
                ans = aCount;
                for (int i = 0; i < aCount; i++)
                {
                    ai += A[i];
                    long count = maxCount(B, k - ai);
                    count += i + 1;
                    if (count > ans)
                    { ans = count; }
                }
            }
            long bCount = maxCount(B, k);
            if (bCount > ans)
            { ans = bCount; }


            WriteLine(ans);
            Out.Flush();
        }

        public static long maxCount(long[] array, long max)
        {
            long time = max;
            long result = 0;
            long num = array.Length;
            while (time > 0 && result < num)
            {
                time -= array[result];
                if (time < 0)
                { break; }
                result++;
            }
            return result;
        }

    }

}