#include <bits/stdc++.h>

using namespace std;

int main()
{
    unsigned long long h, w;
    cin >> h >> w;
    unsigned long long sum = 0;
    if (h > 1 && w > 1)
        sum += h * w;
    unsigned long long a = max (h, w);
    unsigned long long c = a;
    while (a > 1) {
        c += a;
        a--;
    }
    unsigned long long a1 = min (h, w);
    unsigned long long c1 = a1;
    while (a1 > 1) {
        c1 += a1;
        a1--;
    }
    unsigned long long cub = min(h, w) * min (h, w);
    unsigned long long sd = (cub * (h * w / cub));
    if (cub == h * w)
        sd = 0;
    sum += max (c * min (h, w), c1 * max(h, w) + sd);
    cout << sum;
    return 0;
}
