#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fin(s) freopen(s, "r", stdin);
#define fout(s) freopen(s, "w", stdout);
#define ui unsigned int
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pk pop_back
#define pf push_front
#define pt pop_front
void solve() {
    ll h, w ;
    cin >> h >> w ;
    ll s = h * w ;
    ll k = min(h, w) ;
    ll l = max(h, w) ;
    if (k > 1) {
        while (k > 1) {
            s += k * (l - 1) + (k * k + 3 * k - 2) / 2 ;
            h = min(k, l - 1) ;
            w = max(k, l - 1) ;
            k = h ;
            l = w ;
        }
        s += 2 ;
        cout << s ;
    }
    else 
        cout << (l * l + 3 * l - 2) / 2 ;
}
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//    fin("input.txt")
//    fout("output.txt")
    int t = 1;
//    cin >> t;
    while (t--)
        solve();
    return 0;
}