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