#include <bits/stdc++.h>
using namespace std;
int m, b;
long long ans;
inline long long sigma(long long x) {
  long long t = x;
  return (t & 1) ? (t + 1) * (t / 2) + (t + 1) / 2 : (t + 1) * t / 2;
}
int main() {
  scanf("%d %d", &m, &b);
  long long sidy = b, sidx = m * b;
  long long x, y, sq = 0;
  for (x = sidx / 2; x <= sidx; x++) {
    y = b - (x / m);
    if (x % m) y--;
    ans = max(ans, sigma(x) * (y + 1) + sigma(y) * (x + 1));
  }
  cout << ans;
  return 0;
}
