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