#include <bits/stdc++.h>
using namespace std;
int main() {
  long m, b;
  cin >> m >> b;
  long long now = 0LL;
  long long ans = 0LL;
  long long xSum = 0LL;
  long long sum[m * b + 1];
  sum[0] = 0LL;
  for (long i = 1; i <= m * b; i++) {
    sum[i] = sum[i - 1];
    sum[i] += (long long)i;
  }
  for (long x = 0; x <= m * b; x++) {
    long y = (long)((double)-x / (double)m + (double)b + .000001);
    now = sum[y] * (long long)(x + 1);
    now += sum[x] * (long long)(y + 1);
    ans = max(ans, now);
  }
  cout << ans << endl;
  return 0;
}
