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