#include <bits/stdc++.h>
using namespace std;
long long m, b, mx;
int main() {
  ios::sync_with_stdio(false);
  cin >> m >> b;
  for (long long i = m; (i / m) <= b; i += m) {
    long long y = -(i / m) + b;
    long long s = 0;
    s = ((y * (y + 1) + (y + 1) * i) * (i + 1)) / 2;
    mx = max(s, mx);
  }
  cout << mx << '\n';
  return 0;
}
