#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
    long long h, w, sum = 0;
    cin >> h >> w;
    if (h == 1 || w == 1) {
        for (int i = 0; i <= w; i++) {
            if (h == i) {
                continue;
            }
            sum += i*h;
        }
        for (int i = 0; i <= h; i++) {
            if (w == i) {
                continue;
            }
            sum += i*w;
        }
        if (!sum) sum ++;
        cout << sum;
        return 0;
    }
    if (w > h) swap(w, h);
    cout << h*h*w + h+w - (h*w) + h*w << endl;
    return 0;
}
