#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int m, b, ans, i, xx, sum, temp;
  scanf("%lld", &m);
  scanf("%lld", &b);
  ans = 0;
  for (i = 0; i < b + 1; i = i + 1) {
    xx = m * b - m * i;
    if (xx % 2 == 0) {
      sum = xx / 2;
      sum *= (xx + 1);
    } else {
      sum = (xx + 1) / 2;
      sum *= xx;
    }
    sum *= (i + 1);
    if (i % 2 == 0) {
      temp = i / 2;
      temp *= (i + 1);
    } else {
      temp = (i + 1) / 2;
      temp *= i;
    }
    temp *= (1 + xx);
    sum += temp;
    if (ans < sum) ans = sum;
  }
  printf("%lld\n", ans);
  return 0;
}
