#include <bits/stdc++.h>
using namespace std;
long long int calculate(long long int x, long long int y) {
  long long int sumx = (x * (x + 1)) / 2;
  long long int sumy = (y * (y + 1)) / 2;
  sumx = sumx + sumx * y;
  sumy = sumy + sumy * x;
  return (sumx + sumy);
}
int main() {
  long long int m, b;
  cin >> m >> b;
  long long int max = 0;
  long long int by = b;
  long long int bx = m * b;
  long long int x = 0;
  long long int area;
  long long int max1 = 0;
  while (x <= bx - 1) {
    long long int y = (float((-1) * x) / m) + b;
    area = calculate(x, y);
    if (area > max1) {
      max1 = area;
    }
    x++;
  }
  long long int y = 0;
  while (y <= by - 1) {
    long long int x = (b * m) - (y * m);
    area = calculate(x, y);
    if (area > max1) {
      max1 = area;
    }
    y++;
  }
  cout << max1 << endl;
}
