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

int main() {
	long long n, k, res = 0;
	cin >> n >> k;
	if (k < n) swap(k, n);
	res = (k * (k + 1) / 2 - 1 + k) * n + (n * (n + 1) / 2 - 1) * k;
	cout << res;
}
