#include <bits/stdc++.h>
using namespace std;
int a[55][55];
long long f(int x) { return 1LL * x * (x + 1) / 2; }
int main() {
  int m, b;
  cin >> m >> b;
  long long ans = 0;
  for (int x = m;; x += m) {
    int y = -x / m + b;
    if (y < 0) break;
    long long term_x = f(x);
    long long term_y = f(y);
    long long cur = 1LL * x * term_y + term_x + term_y + 1LL * y * term_x;
    if (cur > ans) ans = cur;
  }
  cout << ans << endl;
  return 0;
}
