#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int m, b, ans = 0, x;
  cin >> m >> b;
  for (long long int y = 0; y <= b; y++) {
    x = m * (b - y);
    long long int ans1 = ((x + 1) * (y + 1) * (x + y)) / 2;
    ans = max(ans1, ans);
  }
  cout << ans << endl;
  return 0;
}
