#include <bits/stdc++.h>
using namespace std;

#define ll long long

const int N = 1e6 + 9;

ll n, m;
ll dp[N];


void solve() {
	cin >> n >> m;
	
	if(n > m) swap(n, m);
	
	dp[1] = 1;
	for(int i = 2; i <= m; i++){
		dp[i] = i + 1 + dp[i - 1];
	}
	
	if (n == 1) {
		cout << dp[m];
		return;
	}
	
	ll ans = dp[n] * m;
	
	while (m >= 2) {
		//cout << ans << endl;
		ans += m * n;
		m--;
	}
	cout << ans;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int T = 1;
//	cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}

