#include <bits/stdc++.h>
#define CODE_HERE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
int main()
{
    long long n, m;
    cin >> n >> m;
    if(min(n,m) == 1) {
        cout << n * m + (max(n,m) *(max(n,m) - 1) / 2 + max(n, m) - 1);
    }
    else {
        cout << n * m + min(n, m) * (max(n,m) *(max(n,m) + 1) / 2 + max(n, m) - 1);
    }
}