#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 50;
const long double eps = 1e-7;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long m, b;
  cin >> m >> b;
  long long ans = 0;
  for (long long y = 0; y <= b; y++) {
    long long x = (b - y) * m;
    ans = max(ans, (x * (x + 1) * (y + 1) + y * (y + 1) * (x + 1)) / 2);
  }
  cout << ans << '\n';
}
