#include <bits/stdc++.h>
using namespace std;
const int MX = 1e5 + 9;
const long long INF = (1ll << 60);
const int inf = (1 << 30);
const long long mod = 1e9 + 7;
long long m, b, x;
long long ans;
int main() {
  cin >> m >> b;
  for (int y = b; y >= 0; y--) {
    x = m * (b - y);
    ans = max(ans, (x * (x + 1) / 2) * (y + 1) + (y * (y + 1) / 2) * (x + 1));
  }
  cout << ans << endl;
}
