#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, b;
  scanf("%d%d", &(m), &(b));
  long long ans = 0;
  for (int x = 0; x <= m * b; x++) {
    if (x % m == 0) {
      long long y = (b - x / m);
      long long cand =
          (x + 1) * (y) * (y + 1) / 2 + (y + 1) * (x) * (x + 1) / 2;
      ans = max(ans, cand);
    }
  }
  printf(
      "%lld"
      "\n",
      ans);
  return 0;
}
