#include<bits/stdc++.h>
#define int int64_t
using namespace std;

const int N = 1e5 + 10;

void solve(){
    int n, m, ans = 0;
    cin >> n >> m;
    ans = n * m;
    while (n > 1 && m > 1) {
        if (n > m) swap(n, m);
        ans += n * (n + 1) / 2 + n - 1 + (m - 1) * n;
        m--;
    }
    if (n < m) swap(n, m);
    ans += n * (n + 1) / 2 - 1;
    cout << ans;
    return;
}

int32_t main(){
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif // LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int Q = 1;
//    cin >> Q;
    while(Q -- )solve();
    return 0;
}
