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