#include<bits/stdc++.h>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;

ll cnt = 0;
ll f2(ll w, ll h) {
    cnt++;
    assert(cnt <= 10000000);
    assert(w >= 1 || h >= 1);
    if (h > w)swap(h, w);
    if (w == 1 && h == 1)return 1;
    ll res = w * h + f2(w - 1, h) + h * (h + 1) / 2 + h - 1;
    return res;
}
int main() {
    ll w = 97713, h = 1;
    cin >> h >> w;
    if (w < h)swap(w, h);
    //h <= w
    /*ll ans = h * w;
    if(w < h) swap(w, h);
    if(h == 1)
        ans = 0;
    for(ll l = w; l >= 1; --l)
        ans += w / l * h * l;
    cout << ans << '\n';*/
    cout << f2(w, h);
    return 0;
}
