
#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 + 1) / 2 - 1) + a * (b + b*(b + 1)/2 - 1), a*(b * (b + 1) / 2 - 1) + b * (a + a*(a + 1)/2 - 1));
    
    
    cout <<  ans;
}