#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int m, b, maxval = -1;
  cin >> m >> b;
  for (long long y = 0; y <= b; y++) {
    long long int x = m * (b - y);
    long long int temp = ((x + 1) * (y + 1) * (x + y)) / 2;
    maxval = max(temp, maxval);
  }
  cout << maxval;
}
