#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;
    cin >> h >> w;

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