#include <bits/stdc++.h>

#define pudge ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
//typedef tuple<ll, ll, ll> tll;

const ll INF = 2e18;
const double PI = acos(-1);
const ll MOD7 = 1e9 + (1000 - 7);
const ll MOD9 = 1e9 + 9;
const ll P = 31;
const ld E = 1e-6;
//const ll N = 6250001;
const ll N = 1000006;

ll check(vector<ll> &used) {
    for (int i = 0; i < used.size(); ++i)
        if (used[i] == 0) return 0;
    return 1;
}

int main() {
    pudge;

//    freopen("minmax.in", "r", stdin);
//    freopen("minmax.out", "w", stdout);

    ll h, w;
    cin >> h >> w;
    ll ans;
    if (min(h, w) > 1){
        ans = h*w;
    }else{
        ans = 0;
    }
    while (min(h, w) > 1){
        if (h <= w){
            h--;
            ans += ((2 + w)*(w-1))/2 + w;
        }else{
            w--;
            ans += ((2 + h)*(h-1))/2 + h;
        }
    }
    ll s = max(h, w);
    ans += ((2 + s)*(s-1)/2) + s;
    cout << ans;
}
// 15 1 2 3 4 5 6 7 8 1 3 5 7 3 1 1
// 7 1 2 3 4 1 2 1
// 3 1 2 1
// 15 1 2 3 4 5 6 7 8 1 5 5 7 1 2 1
