#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long maxn = 1e6 + 1;
int main() {
	long long h, w;
	cin >> h >> w;
	vector<long long> dp(maxn);
	dp[1] = 1;
	dp[2] = 4;
	for (int i = 2; i <= maxn; ++i) {
		dp[i] = dp[i - 1] + 1 + i;
	}
	long long ans = 0;
	for (long long leftt = h; leftt > 1; --leftt) {
		ans += (leftt) * (w) + dp[w];
	}
	long long ans2 = 0;
	for (long long leftt = w; leftt > 1; --leftt) {
		ans2 += (leftt) * (h) + dp[h];
	}
	ans2 += dp[h];
	cout << max(ans, ans2) << '\n';
}