#include <bits/stdc++.h>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <string> 
 
#define pb push_back
#define ll long long
#define f first
#define s second

const ll int INF = 1e18, inf = 1e9, mod = 1e9 + 7;


using namespace std;




int main() {
	ll int a, b, sum = 0, ans = 0, mn, mx;
	cin >> a >> b;
	mx = max(a, b);
	mn = min(a, b);
	for (int i = 1; i <= mx - mn; i++) {
		ans = (mn + 1) * (mn) / 2 + mn;
		sum += ans - 1;
	}
	for (int i = mn + 1; i <= mx; i++) {
		sum += mn * i;
	}
	for (int i = 1; i < mn; i++) {
		ll j = i;
		ll x = (j + 1) * j / 2 + j;
		ll y = (j + 2) * (j + 1) / 2 + j + 1;

		sum += (j + 1) * (j + 1) + j * (j + 1);
		sum += x - 1 + y - 1;
	}
	cout << sum + 1;
}