#include<cstdio>
#include<iostream>
#define syy myson
using namespace std;
typedef long long LL;
LL m,b,sum,num,ans,maxx,i,j;
int Main()
{
freopen("mkbanana.in","r",stdin);freopen("mkbanana.out","w",stdout);
cin>>m>>b;
num=b;
for(i=0;i<=m*b;i+=m)
{
sum=((i+1ll)*i/2ll);
ans=(sum+sum+num*(i+1ll))*(num+1ll)/2ll;
if(ans>maxx)maxx=ans;
num--;
}
cout<<maxx;
return 0;
}
int main(){;}
int syy=Main();