#include <bits/stdc++.h>
const long long Inf = 2e9;
long long LINF = (long long)4e18;
using namespace std;
long long mod = 998244353;
int main() {
  ios::sync_with_stdio(false);
  long long m, b;
  cin >> m >> b;
  long long mx = 0;
  for (long long x = 0; x <= 1e8; ++x) {
    long long y = -((x + m - 1) / m) + b;
    if (y < 0) break;
    mx = max(mx, x * (x + 1) / 2 * (y + 1) + y * (y + 1) / 2 * (x + 1));
  }
  cout << mx;
  return 0;
}
