#include <bits/stdc++.h>
#define int unsigned long long
using namespace std;
int n, m,d[1000005];
map<pair<int,int> ,int> dp;
inline unsigned long long rec(int x, int y){
	if(x<1||y<1){
		return (unsigned long long)0;
	}
	if(x<y){
		swap(x,y);
	}
	if(y==1){
		return d[x];
	}
	dp[{x,y}]=rec(x-1,y)+d[y]+(unsigned long long)x*y;
	return dp[{x,y}];
}
main(){
	cin>>n>>m;
	d[1]=1;
	for(int i=2;i<=1000000;i++){
		d[i]=d[i-1]+i+1;
	}
	cout<<rec(n,m);
}
