#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;
}