#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
	ll h, w; cin >> h >> w;
	ll mn = min(h,w), mx = max(h,w);
	ll dp[mx + 7];
	dp[1] = (mn*(mn+1))/2 + mn - 1;
	// cout << dp[1] << "\n";
		for(int i = 2; i <= mx; i++){
			dp[i] = dp[i-1] + dp[1] + i*mn;
			// cout << dp[i] << " ";
		}
	cout << dp[mx] << "\n";
}