#include <bits/stdc++.h>

using namespace std;

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