#include <bits/stdc++.h>

using namespace std;

#define ll long long

ll n, m, ans;

void solve(){
	cin >> n >> m;
	if (n>m)swap(n , m);
	ll ans=(m-1)*n + m*(m+1)/2*n;
	ans+= n*(n-1)/2*m + m*(n-1);
	cout << ans;
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
	return 0;
}