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


int main()
{
    long long a,b;
    cin>>a>>b;

    long long ans =  max(a*b * ceil(log(b)) + b*(a + (a*(a + 1)) / 2 - 1),a*b*ceil(log(a)) + a*(b + (b*(b + 1)) / 2 - 1));
    
    
    cout <<  ans;
}