#include<bits/stdc++.h>
using namespace std;
int main(){
long long a, b;
cin >> a >> b;
long long s1 = 1, s2 = 1;
for(int i = 1; i <= a; i++) s1 *= b;
for(int i = 1; i <= b; i++) s2 *= a;
cout << s1 + s2;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
long long y=1,x=1;
for(int i=1;i<=a;i++)y*=b;
for(int i=1;i<=b;i++)x*=a;
cout<<x+y;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int a,b;cin>>a>>b;
int ans=pow(a,b)+pow(b,a);
cout<<ans;
return 0;
}