#include <bits/stdc++.h>
using namespace std;
long long f(long long x, long long y) {
  return (long long)x * (x + 1) / 2 * (y + 1) +
         (long long)y * (y + 1) / 2 * (x + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int m, b;
  cin >> m >> b;
  long long ans(0LL), x, y;
  ans = (long long)b * (b + 1) / 2;
  for (y = b - 1; y > 0; --y)
    for (x = 0 + (long long)(b - y - 1) * m;
         x <= m + (long long)(b - y - 1) * m; ++x)
      ans = max(ans, f(x, y));
  ans = max(ans, (long long)b * m * (b * m + 1) / 2);
  cout << ans;
  cin.get();
  cin.get();
  return 0;
}
