#include "bits/stdc++.h"

using namespace std;

#define int long long

void solve(){
    int h,w;
    cin >> h >> w;
    if (h >= w) swap(h,w);
    int res = -1;

    for (int i = 0;i < h;i++){
        res += (h - i) + 1;
    }
    int sum = -res;
    for (int i = 0;i <= w;i++){
        sum += (h * (w - i)) + res;
    }

    cout << sum - h;
}

signed main() {
#ifdef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#endif
    int t = 1;
//    cin >> t;

    while (t--) solve();
}
