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