#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll m, b;
  cin >> m >> b;
  ll res = 0;
  for (ll x = 0; x <= b * m; x += m) {
    ll y = b - (x / m);
    ll cur_res = ((x * (x + 1)) / 2) * (y + 1) + ((y * (y + 1)) / 2) * (x + 1);
    if (cur_res > res) {
      res = cur_res;
    }
  }
  cout << res << "\n";
  return 0;
}
