#include <bits/stdc++.h>
using namespace std;
#define accepted ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Daulbekov signed    
#define Makan main
#define int long long
#define double long double
Daulbekov Makan(){
	accepted
	int h,w;
	cin>>h>>w;
	int n=h*w,sum=0;
	if(h==w){
		cout<<(h+w)*(h+w-1);
		return 0;
	}
	for(int i=n;i>=1;i--){
		sum+=i;
	}
	cout<<sum+1;
}