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

#define int long long

using namespace std;

main()
{

    int n, m;
    cin >> n >> m;

    if(n > m)
        swap(n, m);

    int otv = n * m * (m + 1) / 2;
    otv += m * n * (n + 1) / 2;
    otv -= n;
    otv += m * (n - 1);
    cout << otv << endl;
}

