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