#include<bits/stdc++.h>
using namespace  std;
#define ll long long int
#define pb push_back 
#define IShowSpeed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int N=3e5+100;
const int mod=1e9+7;

int main()
{
	IShowSpeed
	ll h,w;
	cin>>h>>w;
	if(h==1 && w==1)
	{
		cout<<1;
		return 0;
	}
	if(w>h) swap(h,w);
	ll x=h;
	for(int i=h;i>=2;i--) x+=i;
	ll sum=0;
	if(w>2) sum=h*(w-1);
	if(w==1) h=0;
	sum+=h*w+x*w;
	cout<<sum;
}