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;

#define ll long long int
#define mp make_pair
#define ff first
#define ss second
#define fr(i,l,r) for (long long int i = l; i < r; ++i)
#define frr(i,l,r) for (long long int i = r; i >= l; --i) 
#define sortarr sort(arr,arr+n) //sorts array in asc order
#define sortarr_r sort(arr, arr+n, greater<long long int>()) //sorts array in desc order
#define make_set set<long long int>s //Set arranges in asc order
#define make_set_r set<long long int, greater <long long int>>s ////Set arranges in desc order
#define make_vector vector<long long int>v; 
#define max_heap priority_queue <int> pq; // max heap 
#define min_heap priority_queue <int, vector<int>, greater<int> > pq;  //min heap
#define make_pairVector vector<pair<long long int,long long int> > pairVector // vector of pairs
#define hashmap unordered_map<long long int, long long int>hashmap;
#define pb push_back


//map<pair<ll,ll>, ll > hash;          // pair,value hashmap where key is a pair
//hash[make_pair(i,j)] = 0;
//if(hash.find(make_pair(i,j)) == hash.end())


//map<ll,ll>::iterator itr;           // iterating a map
//for (itr = hash.begin();itr != hash.end(); itr++)
//{
//   itr->first = key  
//   itr->second = value
//}


// vector<string> v; //to convert vector to a set
// set<string> s(v.begin(), v.end());


// set<string>s;     // to convert set to a vector
// vector<string> v(s.begin(),s.end());


// cin >> x >> y;
// pairVector.pb(mp(x,y));


// string size = str.size()


// stack <int> s; 


// queue <int> gquiz; 


// __gcd(m, n) 

// ll arr[10e5 + 5];


// char arr[10e5 + 5];


// printf ("%.9f\n",x);
// cout << fixed << setprecision(9);



bool sortbysec(const pair<long long int,long long int> &a, const pair<long long int,long long int> &b) 
{ 
    return (a.second < b.second); 
}
bool compare(string &s1,string &s2) 
{ 
    return s1.size() < s2.size(); 
} 
int check_key(map<long long int, long long int> m, long long int key) 
{ 
    // Key is not present 
    if (m.find(key) == m.end()) 
        return 0; 
  
    return 1; 
} 

void yes()
{
    cout << "YES" << endl;
}
void no()
{
    cout << "NO" << endl;
}

int main(void)
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n,m,k;
    cin >> n >> m >> k;

    ll arr1[n+4] = {0}, arr2[m+5] = {0};
    for(ll i = 0; i<n; i++)
    {
        cin >> arr1[i];
    }
    for(ll i = 0; i<m; i++)
    {
        cin >> arr2[i];
    }
    ll c = 0,i,j;
    for(i = 0, j = 0;;)
    {
        if(k > 0)
        {
            // cout << k << endl;
            if(i == n || j == m)
            {
                // f = 1;
                break;
            }
            if(arr1[i] <= arr2[j])
            {
                // cout <<"1               "  << " " << arr1[i] << endl;
                if(k - arr1[i] >= 0)
                {
                    ++c;
                    k-=arr1[i];
                    i++;
                }
                else
                {
                    break;
                }
            }
            else
            {
                // cout <<"2               " << " " << arr2[j] << endl;
                if(k - arr2[j] >= 0)
                {
                    ++c;
                    k-=arr2[j];
                    j++;
                }
                else
                {
                    break;
                }
            }
        }
        else
        {
            break;
        }
    }
    // cout << c << endl;
    // cout << i << " " << j << endl;
    // cout << "h" << endl;
    if(k > 0)
    {
        while(j<m)
        {
            // cout << "jgiufkw" << endl;
            if(k - arr2[j] >= 0)
            {
                ++c;
                k-=arr2[j];
                j++;

            }
            else
            {
                break;
            }
            

        }
        while(i<n)
        {
            if(k - arr1[i] >= 0)
            {
                ++c;
                k-=arr1[i];
                ++i;
            }
            else
            {
                break;
            }
            
                // i++;

        }
    }
    cout << c << endl;
    return 0;
}