#include <bits/stdc++.h>
using namespace std;
string itos(int x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
int m, b;
long long l, r;
long long gety(long long x) { return -(x + m - 1) / m + b; }
long long calc(long long x) {
  long long y = gety(x);
  return y * (y + 1) / 2 * (x + 1) + x * (x + 1) / 2 * (y + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> m >> b;
  r = b;
  while (l != r) {
    long long dx = r - l + 1;
    long long x1 = l + dx / 3, x2 = r - dx / 3;
    x1 *= m, x2 *= m;
    if (dx <= 3) {
      long long r1 = calc(l * m);
      long long r2 = calc(x1);
      long long r3 = calc(r * m);
      cout << max(r1, max(r2, r3)) << endl;
      return 0;
    }
    if (calc(x1) >= calc(x2))
      r = x2 / m;
    else
      l = x1 / m;
  }
  cout << calc(l) << endl;
  return 0;
}
