#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main ()
{
	ll a, z;
	cin>>a;
	z = a+a*a+a*a*a;
	cout<<z<<endl;
	return 0;
}
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	string S;
	cin >> S;

	int s_Len = S.length();

	if (s_Len == 3) {
		reverse(S.begin(), S.end());
	}

	cout << S << endl;

}


