#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int m, b, x = 0, y = 0, mx = 0, num1 = 0, num2 = 0, ans = 0;
  cin >> m >> b;
  long long int i;
  for (i = 0; i <= 10000000; ++i) {
    if (i % m == 0) {
      x = i;
      y = -(i / m) + b;
      if (y >= 0) {
        num1 = (x * (x + 1)) / 2;
        num2 = (y * (y + 1)) / 2;
        ans = (y + 1) * num1 + (x + 1) * num2;
        mx = max(mx, ans);
      } else
        break;
    }
  }
  cout << mx;
  return 0;
}
