#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
int biton(int N, int pos) { return N = N | (1 << pos); }
int bitoff(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
long long int m, b;
long long int ans;
long long int x;
int main() {
  cin >> m >> b;
  for (int y = 0; y <= b; y++) {
    x = m * b - m * y;
    ans = max(ans, (x + 1) * (y + 1) * (x + y) / 2);
  }
  cout << ans << endl;
}
