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 JavaScript (Node.js 12.16.1) (judge verdict: Runtime Error)

"use strict";

const main = arg => {
    const inputList = arg.trim().split("\n");
    // 回答を記述
    const N = parseInt(inputList[0].split(" ")[0]);
    const M = parseInt(inputList[0].split(" ")[1]);
    const K = parseInt(inputList[0].split(" ")[2]);
    const A = inputList[1].split(" ").map(ele => parseInt(ele));
    const B = inputList[2].split(" ").map(ele => parseInt(ele));

    if (K < A[0] && K < B[0]) {
        console.log(0);
    } else {

        let addA = []
        for (let i = 0; i < N; i++) {
            addA[i] = A[i] + (addA[i - 1] ? addA[i - 1] : 0)
            if (addA[i] > K) {
                break;
            }
        }

        let addB = []
        for (let i = 0; i < M; i++) {
            addB[i] = B[i] + (addB[i - 1] ? addB[i - 1] : 0)
            if (addB[i] > K) {
                break;
            }
        }

        if ((addA[addA.length - 1] + addB[addB.length - 1]) <= K) {
            console.log(addA.length + addB.length)
        } else {
            let result = 0;
            for (let j = 0; j < addA.length; j++) {
                let num = addA[j];
                for (let k = 0; k < addB.length; k++) {
                    let num2 = addB[k];
                    if ((num + num2) <= K) {
                        result = Math.max(result, j + k + 2)
                    } else {
                        break;
                    }
                }

            }

            console.log(result)
        }
    }

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));