#include <iostream>
#include <vector> 
#include<math.h>
#include <algorithm>
using namespace std; 
int main()
{ 
int a;
long long k;
cin>>a;
k=a+a*a+a*a*a;
cout<<k;
}
# include<iostream>
# include<math.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a;
    b=pow(a,1)+pow(a,2)+pow(a,3);
    cout<<b<<"\n";


}
