#include <bits/stdc++.h>
using namespace std;
long long bananaz(long long x, long long y) {
  return (x + 1) * (y + 1) * (x + y) / 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long m, b, x = 0, y, max = -1;
  cin >> m >> b;
  y = b;
  while (y >= 0) {
    if (bananaz(x, y) > max) max = bananaz(x, y);
    x++;
    while (y > -1.0 * x / m + b) y--;
  }
  cout << max << endl;
}
