#include <bits/stdc++.h>
using namespace std;
long long m, b;
long long find_x(long long y) { return (y - b) * (-m); }
long long acum(long long n) { return (n * (n + 1)) / 2; }
int main() {
  cin >> m >> b;
  long long x, ans = 0;
  for (long long y = b; y >= 0; y--) {
    x = find_x(y);
    ans = max(ans, (acum(y) * (x + 1)) + (acum(x) * (y + 1)));
  }
  cout << ans << endl;
  return 0;
}
