#include <bits/stdc++.h>

#define ll long long

using namespace std;

int main() {
    vector < ll > a(2);
    cin >> a[0] >> a[1];
    sort(a.rbegin(), a.rend());
    ll h, w;
    h = a[0];
    w = a[1];
    ll t = w * h;
    ll sum = 0;
    ll c = w, l = 0;
    //if (h > w) swap(h, w);
    while (w > 1) {
        sum += (w * h) * (t / (w * h));
        w--;
    }
    while (h > 1) {
        sum += h * (t / h);
        sum -= l;
        if (t % h == 0) l += c;
        h--;
    }
    cout << sum + t;
    return 0;
}
