#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T assign_min(T& A, const T& B) {
  return A = std::min(A, B);
}
template <class T>
inline T assign_max(T& A, const T& B) {
  return A = std::max(A, B);
}
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = (const int)(1e9 + 7);
const int MAXN = (const int)(2e5 + 10);
int m, b;
int main() {
  std::ios::sync_with_stdio(false);
  cin >> m >> b;
  long long ans = 0;
  for (long long y = b; y >= 0; --y) {
    long long x = m * (b - y);
    assign_max(ans, (x + y) * (x + y + x * y + 1) >> 1);
  }
  cout << ans << endl;
  return 0;
}
