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