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 Java (OpenJDK 11.0.6) (judge verdict: Runtime Error)

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		int K=sc.nextInt();
		int[] A=new int[N];
		int[] B=new int[M];
		int[] Asum=new int[N+1];
		int[] Bsum=new int[M+1];

		Asum[0]=0;
		int sum=0;
		for (int i = 0; i < N; i++) {
			A[i]=sc.nextInt();
			sum+=A[i];
			Asum[i+1]=sum;
		}

		Bsum[0]=0;
		sum=0;
		for (int i = 0; i <M; i++)  {
			B[i]=sc.nextInt();
			sum+=B[i];
			Bsum[i]=sum;
		}

		int ans=0, jj=0;
		for (int i = 0; i <=N; i++) {
			if(Asum[i]>K)  break;

			for (int j = 0; j <=M; j++) {
				jj=j;
				if(Bsum[j]>K-Asum[i])  break;
			}

			ans=Math.max(ans, i+jj);
		}
		System.out.println(ans);
	}
}