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