#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)(1e8);
const int OO = (int)(1e9 + 2);
using namespace std;
long long y, mmax = -1ll, c;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int m, b;
  cin >> m >> b;
  for (long long x = 0ll; x <= (long long)(1e7); x++) {
    if ((x % m) == 0) {
      y = ((-1 * x) / m) + b;
      if (y >= 0) {
        c = (x + 1) * (y + 1) * (x + y) / 2;
        mmax = max(mmax, c);
      }
    }
  }
  cout << mmax;
  return 0;
}
