#include <bits/stdc++.h>
using namespace std;
long long m, b;
long long ans;
int main(int argc, const char* argv[]) {
  cin >> m >> b;
  for (int y = 0; y <= b; y++) {
    long long x = m * (b - y);
    long long temp = (x + y) * (x + 1) * (y + 1) / 2;
    ans = max(ans, temp);
  }
  cout << ans << endl;
  return 0;
}
