#include <iostream>
using namespace std;

int main() {
    int h, w;
    cin >> h >> w;

    long long out = 0;
    while (h && w) {
        out += static_cast<long long>(h) * w;
        out += static_cast<long long>(min(h, w)) + (static_cast<long long>(min(h, w) + 2) * (min(h, w) - 1) / 2);

        if (h == max(h, w)) {
            h--;
        } else {
            w--;
        }
    }

    cout << out - 1 << endl;

    return 0;
}
