// [ ﷽ ] Bismillahir Rahmanir Raheem//
#include<bits/stdc++.h>
#include<iostream>
#define ff first
#define ss second
#define pb push_back
#define int long long
#define noob ios::sync_with_stdio(0);cin.tie(0);
using namespace std;
void solve2(){
int m,b;
cin>>m>>b;
int ans=0;
for(int i=b;i>=0;i--){
int j=b*m-m*i;
int ct=(i*(i+1)/2)*(j+1)+(j*(j+1)/2)*(i+1);
ans=max(ans,ct);
}
cout<<ans<<endl;
}
void solve(){
int x,y;
for(int i=1;i<=5;i++){
for(int j=1;j<=5;j++){
int z;
cin>>z;
if(z==1){
x=i,y=j;
}
}
}
cout<<abs(3-x)+abs(3-y)<<endl;
}
void solve3(){
double x;
int a;
int n;
cin>>n>>a;
int r,s,t;
double y=1.0*a;
x=1.0*(n-2)*180/n;
int k=n-3;
double f=abs(x-y);
r=1,s=2,t=3;
int m=n;
//cout<<x<<" "<<f<<" ";
double p=(x/(1.0*(k+1)));
for(int i=1;i<=k;i++){
double d=p*(1.0)*i;
// cout<<d<<" "<<abs(d-y)<<" "<<f<<endl;
if(abs(d-y)<f){
t=m;
f=abs(d-y);
}
m--;
}
cout<<r<<" "<<s<<" "<<t<<endl;
}
signed main(){
noob
int t=1;
// cin>>t;
while(t--){
solve2();
}
return 0;
}
274. H-Index | 260. Single Number III |
240. Search a 2D Matrix II | 238. Product of Array Except Self |
229. Majority Element II | 222. Count Complete Tree Nodes |
215. Kth Largest Element in an Array | 198. House Robber |
153. Find Minimum in Rotated Sorted Array | 150. Evaluate Reverse Polish Notation |
144. Binary Tree Preorder Traversal | 137. Single Number II |
130. Surrounded Regions | 129. Sum Root to Leaf Numbers |
120. Triangle | 102. Binary Tree Level Order Traversal |
96. Unique Binary Search Trees | 75. Sort Colors |
74. Search a 2D Matrix | 71. Simplify Path |
62. Unique Paths | 50. Pow(x, n) |
43. Multiply Strings | 34. Find First and Last Position of Element in Sorted Array |
33. Search in Rotated Sorted Array | 17. Letter Combinations of a Phone Number |
5. Longest Palindromic Substring | 3. Longest Substring Without Repeating Characters |
1312. Minimum Insertion Steps to Make a String Palindrome | 1092. Shortest Common Supersequence |