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++ (GCC 9.2.1) (judge verdict: Runtime Error)

#include <bits/stdc++.h>
using namespace std;

int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  long long int N,M,K;
  cin >> N >> M >> K;
  long long int A[N+1], B[M+1];
  A[0]=0;
  B[0]=0;
  long long int C=N;
  
  for(long long int i=1;i<N+1;i++){
    cin >> A[i];
    A[i] = A[i]+A[i-1];
    if(C==N && A[i]>K){
      C = i-1;
    }
  }

  for(long long int i=1;i<M+1;i++){
    cin >> B[i];
    B[i] = B[i]+B[i-1];
    if(B[i]>K){
      break;
    }
  }
  long long int D=0;
  while(A[C] + B[D+1]<=K && D<M){
    D++;
  }
  //cout << C << ":" << D << endl;
  long long int Max = C+D;
  for(long long int i=1;i<C+1;i++){
    while(A[C-i]+B[D+1]<=K){
      if(D==M){
        break;
      }
      D++;
    }
    //cout << C-i << ":" << D << endl;
    Max = max(Max, C-i+D);
  }
cout << Max <<endl;
  return 0;
}


int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}