#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
   
    ll h, w; cin >> h >> w;
    if (h < w) swap(h, w);
    ll pr1 = h * (h + 1) / 2 + (h - 1);
    //cout << "DBG1: " << pr1 << endl;
    ll pr2 = w * (w + 1) / 2 - 1;
    ll ans = pr1 * w + pr2 * h;
    cout << ans << endl;
}