
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;


int main()
{
    long long a,b;
    cin>>a>>b;
    long long ans =  max(b*(a + (a*(a + 1)) / 2 - 1),a*(b + (b*(b + 1)) / 2 - 1));
    if(a != 1 and b != 1){
        ans += a * b;
    }
    
    cout <<  ans;
}