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