#include <bits/stdc++.h>

using namespace std;

unsigned long long pr[1000500];

#define int unsigned long long

signed main()
{
    unsigned long long h, w;
    cin >> h >> w;
    unsigned long long sum = h * w;
    pr[0] = 0;
    pr[1] = 1;
    for (int i = 2; i <= max (w, h) + 2; i++)
        pr[i] = pr[i - 1] + i + 1;
    int a, c;
    while (h || w)
    {
        if (h > w) {
            h--;
            a = pr[w];
        } else {
            w--;
            a = pr[h];
        }
        sum += a + h * w;


    }
    cout << sum - 1;
    return 0;
}
