#include <bits/stdc++.h>
using namespace std;
long long int sum(long long int x) { return (x * (x + 1)) / 2; }
int main() {
  int t = 1;
  while (t--) {
    int m, b;
    cin >> m >> b;
    long long int y = b;
    long long int max = -1;
    while (y >= 0) {
      long long int x = b * m - m * y;
      long long int sigmax = sum(x) * (y + 1);
      long long int sigmay = sum(y) * (x + 1);
      if (sigmay + sigmax > max) {
        max = sigmay + sigmax;
      }
      y--;
    }
    cout << max;
  }
  return 0;
}
