#include<iostream>
#include<cstdio>
using namespace std;
long long math(long long n,long long m)
{
long long t,ans;
if(n>m)
{
t=m;
m=n;
n=t;
}
ans=(n*(n-1)*m+m*(m-1)*n+2*n*(n-1)*(m-n+1)+2*n*(n-1)*(2*n-4)/3);
return ans;
}
int main()
{
freopen("chessqueen.in","r",stdin);
freopen("chessqueen.out","w",stdout);
string s;
long long x,y;
/*while(cin>>s)
{
cin>>x>>y;
cout<<s<<endl;
cout<<math(x,y)<<endl;
}
*/
cin>>x>>y;
cout<<math(x,y);
return 0;
}