#include <bits/stdc++.h>
using namespace std;
long long sum(int n) { return (float(n + 1) * float(n) / 2); }
long long grpsum(long long n, long long gn) {
  long long thesum = 0;
  long long l = 0;
  long long i = n - gn;
  long long q = (i + 1);
  thesum = sum(i);
  if (gn != 0) thesum += gn * thesum + sum(gn) * q;
  return thesum;
}
int main() {
  int m, b;
  cin >> m >> b;
  int x;
  long long res = 0;
  for (int i = 0; i < b; i++) {
    x = (b - i) * m;
    res = max(res, grpsum(x + i, i));
  }
  cout << res;
  return 0;
}
