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

typedef long long ll;
typedef unsigned long long ull;

vector <ull> cache(1000001, 0);

int main()
{
    ull res = 1;
    ull n, m;
    cin >> n >> m;
    cache[1] = 1;
    cache[2] = 4;
    for (ull i = 3; i <= min(m, n); i++) {
        cache[i] = cache[i-1] + i + 1;
    }
    int i = max(m, n), j = min(n, m);
    while (i != 1 || j != 1) {
        if (i < j)
            swap(i, j);
        res += i*j + cache[j];
        i--;
    }
    cout << res;
    return 0;
}
