#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int m, b;
  cin >> m >> b;
  long long int MAX = 0;
  for (long long int x = 0; x <= b * m; ++x) {
    long long int y = (m * b - x) / m;
    MAX = max(MAX, (y + 1) * (x + y) * (x + 1) / 2);
  }
  cout << MAX;
  return 0;
}
