#include <bits/stdc++.h>
using namespace std;
namespace {
template <class T, std::size_t N>
ostream& operator<<(ostream& fout, const array<T, N>& a) {
  for (size_t i = 0; i < N; ++i) {
    fout << a[i] << ' ';
  }
  return fout;
}
template <class T>
ostream& operator<<(ostream& fout, const vector<T>& vec) {
  for (size_t i = 0; i < vec.size(); ++i) {
    fout << vec[i] << ' ';
  }
  return fout;
}
template <class T>
istream& operator>>(istream& fin, vector<T>& vec) {
  for (size_t i = 0; i < vec.size(); ++i) {
    cin >> vec[i];
  }
  return fin;
}
template <class T, size_t N>
istream& operator>>(istream& fin, array<T, N>& a) {
  for (size_t i = 0; i < N; ++i) cin >> a[i];
  return fin;
}
}  // namespace
int main(int argc, const char* argv[]) {
  ios_base::sync_with_stdio(false);
  long long m, b;
  cin >> m >> b;
  long long mx = max(b * (b + 1) / 2, m * b * (m * b + 1) / 2);
  long long s = mx;
  for (long long x = 0; x < m * b; ++x) {
    long long y = (x % m) == 0 ? (-x / m + b) : (-x / m - 1) + b;
    s = (x + 1) * (y + 1) * y / 2 + (y + 1) * (x + 1) * x / 2;
    mx = max(mx, s);
  }
  cout << mx << "\n";
  return 0;
}
