#include <bits/stdc++.h>
#define CODE_HERE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
typedef long long ll;
using namespace std;
void solve()
{
    ll h, w, a, res, b;
    cin >> h >> w;
    a = max(h, w);

    res = min(h, w) * (a * (a + 1) / 2 - 1);

    a = min(h, w);
    b = (a * (a + 1) / 2 - 1 + a) * (max(h, w)); 
    res += b;
    cout << res;
}
int main()
{
    CODE_HERE;
    int t;
    for (t = 1; t > 0; t--) solve();
}