#include "bits/stdc++.h"
using namespace std;
const int inf = 1e9;
using ll = long long;

int main() {
    cin.tie(0)->sync_with_stdio(false);
    ll a, b; a = 1000000, b = 1;
    ll ans = 0;
    vector<ll> h(1e6 + 1);
    ans += a * b;
    ll k = 0;
    while(a > 1 || b > 1){
        if(a < b) swap(a, b);
        ans += (b == 1 ? b : 2 * b);
        k ++;
        a --;

        h[k] = ans;
        ans += a * b;
    }
    cin >> a >> b;
    ans = a * b;
    while(a > 1 || b > 1){
        if(a < b) swap(a, b);
        ans += (b + 1) * b / 2 + b - 1;

        a --;
        ans += a * b;
        h[a + 1] = ans;
    }
    h[1]= 1;

    cout << ans;
}