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