#include<bits/stdc++.h>
#define MOD 1000000007
#define mp make_pair
#define ll long long
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug cout<<"Debugging.."<<endl
using namespace std;
int main()
{
	faster;

		ll int n;
		cin>>n;
		
		int a=pow(n,2);
		int b=pow(n,3);
		cout<<a+b+n;
	

	
}



#include"bits/stdc++.h"
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main(){
	int a;
	int ans;
	cin>>a;
	ans=a+a*a+a*a*a;
	cout<<ans<<endl;

	return 0;
}