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