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