#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MAXN 200001
#define pb push_back
#define mp make_pair
#define MOD (ll)1e9+7
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i, a, b) for(int i = a; i < b; ++i)
ll m, b;
bool check(ll x, ll y) {
double y0 = (double)-x/m + b;
if(y < y0)
return true;
if(abs(y0-y) <= 0.0000000000001)
return true;
return false;
}
ll calcc(ll x, ll y) {
return (x*(x+1))/2 * (y+1) + (y*(y+1))/2 * (x+1);
}
int main() {
FASTIO
cin >> m >> b;
ll ans = 0;
for(ll i = 1000; i >= 0; --i) {
for(ll j = 10000; j >= 0; --j) {
if(check(i, j)) {
ans = max(ans, calcc(i, j));
}
}
}
cout << ans;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKdHlwZWRlZiBwYWlyPGludCwgaW50PiBQSUk7CnR5cGVkZWYgdmVjdG9yPGludD4gVkk7CgojZGVmaW5lIE1BWE4gMjAwMDAxCiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgbXAgbWFrZV9wYWlyCiNkZWZpbmUgTU9EIChsbCkxZTkrNwojZGVmaW5lIEZBU1RJTyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOyBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsKI2RlZmluZSByZXAoaSwgYSwgYikgZm9yKGludCBpID0gYTsgaSA8IGI7ICsraSkKCmxsIG0sIGI7Cgpib29sIGNoZWNrKGxsIHgsIGxsIHkpIHsKICAgIGRvdWJsZSB5MCA9IChkb3VibGUpLXgvbSArIGI7CiAgICBpZih5IDwgeTApCiAgICAgICAgcmV0dXJuIHRydWU7CiAgICBpZihhYnMoeTAteSkgPD0gMC4wMDAwMDAwMDAwMDAxKQogICAgICAgIHJldHVybiB0cnV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