import java.util.*;
import java.math.*;
import java.io.*;

/**
 *
 * @author saumya
 */

public class Banana{

	public static void main(String[] args){
		int mod = (int) (1e9+7);
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int m = in.nextInt();
		int b = in.nextInt();
		ArrayList<Pair> arr = new ArrayList<Pair>();
		for(int i = b;i>=0;i--){
			int j = m*b-m*i;
					if(j>=0){
					Pair p = new Pair(i,j);
					arr.add(p);
					}

		}
		long global = 0;
		//out.println(arr.size());
		for(int i=0;i<arr.size();i++){

			long r = arr.get(i).x;
			long c = arr.get(i).y;
			//out.println(r+ " " +c);

			long rs = (r*(r+1))/2;
			long cs = (c*(c+1))/2;
			long sum = rs*(c+1);
			sum += cs*(r+1);
			if(global<sum){
				global = sum;
			}
		}

		if(b==1){
			if(global < (m*(m+1))/2)
				global = (m*(m+1))/2;
		}
		if((b*(b+1)/2)>global){
			global = b*(b+1/2);
		}
		if((m*b)*(m*b+1)/2>global){
			global = (m*b)*(m*b+1)/2;
		}

		out.println(global);
		out.close();
	}

	    static class Pair implements Comparable<Pair>{

        int x,y;

	Pair (int x,int y){
		this.x=x;
		this.y=y;

	}

	public int compareTo(Pair o) {
		if(this.x!=o.x)
                    return Long.compare(this.x,o.x);
		else
                    return Long.compare(this.y,o.y);
		//return 0;
	}

    }

    public static boolean isPal(String s){
        for(int i=0, j=s.length()-1;i<=j;i++,j--){
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
    }
    public static String rev(String s){
		StringBuilder sb=new StringBuilder(s);
		sb.reverse();
		return sb.toString();
    }

    public static long gcd(long x,long y){
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
    }

    public static int gcd(int x,int y){
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
    }

    public static long gcdExtended(long a,long b,long[] x){

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

    public static int abs(int a,int b){
	return (int)Math.abs(a-b);
    }

    public static long abs(long a,long b){
	return (long)Math.abs(a-b);
    }

    public static int max(int a,int b){
	if(a>b)
		return a;
	else
		return b;
    }

    public static int min(int a,int b){
	if(a>b)
		return b;
	else
		return a;
    }

    public static long max(long a,long b){
	if(a>b)
		return a;
	else
		return b;
    }

    public static long min(long a,long b){
	if(a>b)
		return b;
	else
		return a;
    }

    public static long pow(long n,long p,long m){
	 long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    if(result>=m)
	    result%=m;
	    p >>=1;
	    n*=n;
	    if(n>=m)
	    n%=m;
	}
	return result;
    }

    public static long pow(long n,long p){
	long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    p >>=1;
	    n*=n;
	}
	return result;
    }

	static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public long[] nextLongArray(int n) {
			long a[] = new long[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextLong();
			}
			return a;
		}

		public String readString() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}

import java.util.Scanner;

public class Code1 {

    static long x0, y0;
    static long x, y;
    static long m, b;

    static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        m = in.nextInt();
        b = in.nextInt();

        long x0 = getX(0);
        long y0 = b;
        long maxSum = 0;

        if (x0 <= y0) {
            for (long i = 0; i <= x0; i++) {
                x = i;
                double yy = getY(x);
                if (Math.ceil(yy) == Math.floor(yy)) {
                    y = (long) yy;
                } else {
                    continue;
                }
                long sum = trees(x, y);
                if (sum > maxSum) {
                    maxSum = sum;
                }
            }
        } else {
            for (long i = 0; i <= y0; i++) {
                y = i;
                x = getX(y);
                long sum = trees(x, y);
                if (sum > maxSum) {
                    maxSum = sum;
                }
            }

        }
        System.out.println(maxSum);
    }

    public static long getX(long y) {
        return (b - y) * m;
    }

    public static double getY(long x) {
        return -x / (double) m + b;
    }

    public static long trees(long x, long y) {
        long sumX = x * (x + 1) / 2;
        sumX = sumX * (y + 1);

        long sumY = y * (y + 1) / 2;
        sumY = sumY * (x + 1);

        return sumX + sumY;
    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Say My Name
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        BOkabeAndBananaTrees solver = new BOkabeAndBananaTrees();
        solver.solve(1, in, out);
        out.close();
    }

    static class BOkabeAndBananaTrees {
        public void solve(int testNumber, InputReader c, OutputWriter w) {
            int m = c.readInt(), b = c.readInt();
            long max = 0;
            for (long y = 0; y <= b; y++) {
                long x = -y * m + b * m;
                long res = ((y * (y + 1)) / 2) * (x + 1) + ((x * (x + 1)) / 2) * (y + 1);
                max = Math.max(max, res);
            }
            w.printLine(max);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Say My Name
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        BOkabeAndBananaTrees solver = new BOkabeAndBananaTrees();
        solver.solve(1, in, out);
        out.close();
    }

    static class BOkabeAndBananaTrees {
        public void solve(int testNumber, InputReader c, OutputWriter w) {
            int m = c.readInt(), b = c.readInt();
            long max = 0;
            for (long x = 0; x <= m * b; x++) {
                long y = -((x - 1) / m + 1) + b;
                long res = ((y * (y + 1)) / 2) * (x + 1) + ((x * (x + 1)) / 2) * (y + 1);
                max = Math.max(max, res);
                //w.printLine(res);
            }
            w.printLine(max);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.Scanner;

public class MainB {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int m = in.nextInt();
		int b = in.nextInt();
		in.nextLine();
		long max = 0;
		for(long y=b; y>=0; y--) {
			long x = m*(b-y);
			long total = (long)(x*(x + 1) * (y+1) / 2 + y*(y+1)*(x + 1)/2);
			max = Math.max(total, max);
		}
		System.out.println(max);
		in.close();
	}
}

import java.io.*;
import java.util.*;

public class B {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int m = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());

        long best = 0;
        for (int i = 0; i <= b; i++)
        {
            int x = getFirst(m, b, i);
            long tot = score(x, i);
            if (tot > best)
            {
                best = tot;
            }
        }
        System.out.println(best);
    }

    public static int getFirst(int m, int b, int y)
    {
        return (b - y) * m;
    }

    public static long score(long x, long y)
    {
        long sum = 0;
        while (y != 0)
        {
            if (x % 2 == 0)
            {
                sum += y * (x + 1) + ((x / 2) * (x + 1));
            }
            else
            {
                sum += y * (x + 1) + ((x + 1) / 2 * x);
            }
            y--;
        }

        if (x % 2 == 0)
        {
            sum += ((x / 2) * (x + 1));
        }
        else
        {
            sum += ((x + 1) / 2 * x);
        }
        return sum;
    }
}

import java.util.*;
import java.io.*;

public class OkabeAndBananaTrees {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] input = in.readLine().split(" ");
    int M = Integer.parseInt(input[0]);
    int B = Integer.parseInt(input[1]);
    long max = 0;
    long x = 0;
    for(long y = B; y >= 0; y--) {
      max = Math.max(max, (x+1)*(y+1)*(x+y)/2);
      x += M;
    }
    System.out.println(max);
  }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class OkabeBananaTrees {
    void solve() {
        int m = in.nextInt(), b = in.nextInt();

        long ans = 0;
        for (int y = 0; y <= b; y++) {
            int x = (b - y) * m;
            long sum = (long) x * (x + 1) / 2 * (y + 1) + (long) y * (y + 1) / 2 * (x + 1);
            ans = Math.max(ans, sum);
        }
        out.println(ans);
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new OkabeBananaTrees().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.util.Scanner;

/**
 * Created by phuoc on 6/27/17.
 */
public class BananaTree {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int m, b;
        m = in.nextInt();
        b = in.nextInt();
        long max = 0;
        for (long y = 0; y <= b; y++) {
            long x = (b - y) * m;
            long sum = (x + 1) * (y + 1) * (x + y) / 2;
            if (sum > max) max = sum;
        }
        System.out.println(max);
    }
}

import java.util.HashSet;
import java.util.Scanner;

public class Solution {

	private static long m;
	private static long b;

	private static long checkItOut(long currentX) {

		if (currentX % m != 0)
			return 0;

		long result = 0;

		long currentY = -1 * currentX / m + b;

		long oneStep = (currentX * (currentX + 1)) / 2;
		long toAdd = currentX + 1;

		for (long i = 0; i <= currentY; i++) {
			result += oneStep;
			oneStep += toAdd;
		}

		return result;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		m = in.nextLong();
		b = in.nextLong();
		long max = 0;
		for (long i = 0; i <= m * b; i++) {
			long currentHarvest = checkItOut(i);
			if (currentHarvest > max){
				max = currentHarvest;
			}
		}
		System.out.println(max);

	}

}

//pakage joney_000[let_me_start]
//
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
/*
 * Author    : joney_000[let_me_start]
 * Algorithm : N/A
 * Platform  : N/A
 *
 */

/*    The Main Class                */
public class A
{
  private InputStream inputStream ;
  private OutputStream outputStream ;
  private FastReader in ;
  private PrintWriter out ;
  /*
    Overhead [Additional Temporary Strorage] but provides memory reusibility for multiple test cases.
    Size Limit : 10^5 + 4
  */
  private final int BUFFER = 5;
  private int    tempints[] = new int[BUFFER];
  private long   templongs[] = new long[BUFFER];
  private double tempdoubles[] = new double[BUFFER];
  private char   tempchars[] = new char[BUFFER];
  private final long mod = 1000000000+7;
  private final int  INF  = Integer.MAX_VALUE / 10;
  private final long INF_L  = Long.MAX_VALUE / 10;

  public A(){}
  public A(boolean stdIO)throws FileNotFoundException{
    // stdIO = false;
    if(stdIO){
      inputStream = System.in;
      outputStream = System.out;
    }else{
      inputStream = new FileInputStream("output.txt");
      outputStream = new FileOutputStream("output1.txt");
    }
    in = new FastReader(inputStream);
    out = new PrintWriter(outputStream);

  }

  void run()throws Exception{
    long m = i(); long b = i();
    // x + my = b*m
    // my <= b*m - x
    long max = 0;
    for(long x = 0; x <= 10000000; x++){
      //for(long y = 0; y <= 100000; y++){
        long  my = b * m - x;
        long y = my/m;
        if(my >= 0 && y >= 0){
          max = Math.max(max, get(x, y));
        }
    }
    out.write(""+max+"\n");
  }// end run
long get(long i, long j){
  long sigx = i * (i + 1);
  long sigy = j * (j + 1);
  sigy /= 2;
  sigx /= 2;
  long res = sigx + sigy + i * sigy + j * sigx;
  return res;
}
void clear(int n){

}
//****************************** My Utilities ***********************//

void print_r(Object... o){
  out.write("\n"+Arrays.deepToString(o)+"\n");
  out.flush();
}

boolean isPrime(long n){
  if(n==1)return false;
  if(n<=3)return true;
  if(n%2==0)return false;
  for(int i=2 ;i <= Math.sqrt(n); i++){
    if(n%i==0)return false;
  }
  return true;
}
  // sieve
  int[] primes(int n){       // for(int i=1;i<=arr.length-1;i++)out.write(""+arr[i]+" ");
  boolean arr[] = new boolean[n+1];
  Arrays.fill(arr,true);
  arr[1]=false;
  for(int i=2;i<=Math.sqrt(n);i++){
    if(!arr[i])continue;
    for(int j = 2*i ;j<=n;j+=i){
      arr[j]=false;
    }
  }
  LinkedList<Integer> ll = new LinkedList<Integer>();
  for(int i=1;i<=n;i++){
    if(arr[i])ll.add(i);
  }
  n = ll.size();

  int primes[] = new int[n+1];
  for(int i=1;i<=n;i++){
    primes[i]=ll.removeFirst();
  }
  return primes;
}
long gcd(long a , long b){
  if(b==0)return a;
  return gcd(b , a%b);
}
long lcm(long a , long b){
  if(a==0||b==0)return 0;
  return (a*b)/gcd(a,b);
}
long mulmod(long a , long b ,long mod){
  if(a==0||b==0)return 0;
  if(b==1)return a;
  long ans = mulmod(a,b/2,mod);
  ans = (ans*2)% mod;
  if(b%2==1)ans = (a + ans)% mod;
  return ans;
}
long pow(long a , long b ,long mod){
  if(b==0)return 1;
  if(b==1)return a;
  long ans = pow(a,b/2,mod);
  ans = (ans * ans);
  if(ans >= mod )ans %= mod;

  if(b%2==1)ans = (a * ans);
  if(ans >= mod )ans %= mod;

  return ans;
}
  // 20*20   nCr Pascal Table
long[][] ncrTable(){
  long ncr[][] = new long[21][21];
  for(int i=0 ;i<=20 ;i++){ncr[i][0]=1;ncr[i][i]=1;}
    for(int j=0;j<=20 ;j++){
      for(int i=j+1;i<= 20 ;i++){
        ncr[i][j] = ncr[i-1][j]+ncr[i-1][j-1];
      }
    }
    return ncr;
  }
  //*******************************I/O******************************//
  int i()throws Exception{
    //return Integer.parseInt(br.readLine().trim());
    return in.nextInt();
  }
  int[] is(int n)throws Exception{
  //int arr[] = new int[n+1];
    for(int i=1 ; i <= n ;i++)tempints[i] = in.nextInt();
      return tempints;
  }
  long l()throws Exception{
    return in.nextLong();
  }
  long[] ls(int n)throws Exception{
    for(int i=1 ; i <= n ;i++)templongs[i] = in.nextLong();
      return templongs;
  }

  double d()throws Exception{
    return in.nextDouble();
  }
  double[] ds(int n)throws Exception{
    for(int i=1 ; i <= n ;i++)tempdoubles[i] = in.nextDouble();
      return tempdoubles;
  }
  char c()throws Exception{
    return in.nextCharacter();
  }
  char[] cs(int n)throws Exception{
    for(int i=1 ; i <= n ;i++)tempchars[i] = in.nextCharacter();
      return tempchars;
  }
  String s()throws Exception{
    return in.nextLine();
  }
  BigInteger bi()throws Exception{
    return in.nextBigInteger();
  }
//***********************I/O ENDS ***********************//
//*********************** 0.3%f [precision]***********************//
/* roundoff upto 2 digits
   double roundOff = Math.round(a * 100.0) / 100.0;
                    or
   System.out.printf("%.2f", val);

*/
/*
  print upto 2 digits after decimal
  val = ((long)(val * 100.0))/100.0;

*/

    private void closeResources(){
     out.flush();
     out.close();
     return;
    }
    public static void main(String[] args) throws java.lang.Exception{
    //let_me_start Shinch Returns

    /*
        // Old Reader Writer
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
    BufferedReader br=new BufferedReader(new FileReader("input.txt"));
        BufferedWriter out=new BufferedWriter(new FileWriter("output.txt"));
    */
        A driver = new A(true);

        driver.run();

        driver.closeResources();
        return ;

      }

    }

    class FastReader{

      private boolean finished = false;

      private InputStream stream;
      private byte[] buf = new byte[4 * 1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;

      public FastReader(InputStream stream){
        this.stream = stream;
      }

      public int read(){
        if (numChars == -1){
          throw new InputMismatchException ();
        }
        if (curChar >= numChars){
          curChar = 0;
          try{
            numChars = stream.read (buf);
          } catch (IOException e){
            throw new InputMismatchException ();
          }
          if (numChars <= 0){
            return -1;
          }
        }
        return buf[curChar++];
      }

      public int peek(){
        if (numChars == -1){
          return -1;
        }
        if (curChar >= numChars){
          curChar = 0;
          try{
            numChars = stream.read (buf);
          } catch (IOException e){
            return -1;
          }
          if (numChars <= 0){
            return -1;
          }
        }
        return buf[curChar];
      }

      public int nextInt(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        int sgn = 1;
        if (c == '-'){
          sgn = -1;
          c = read ();
        }
        int res = 0;
        do{
          if(c==','){
            c = read();
          }
          if (c < '0' || c > '9'){
            throw new InputMismatchException ();
          }
          res *= 10;
          res += c - '0';
          c = read ();
        } while (!isSpaceChar (c));
        return res * sgn;
      }

      public long nextLong(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        int sgn = 1;
        if (c == '-'){
          sgn = -1;
          c = read ();
        }
        long res = 0;
        do{
          if (c < '0' || c > '9'){
            throw new InputMismatchException ();
          }
          res *= 10;
          res += c - '0';
          c = read ();
        } while (!isSpaceChar (c));
        return res * sgn;
      }

      public String nextString(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        StringBuilder res = new StringBuilder ();
        do{
          res.appendCodePoint (c);
          c = read ();
        } while (!isSpaceChar (c));
        return res.toString ();
      }

      public boolean isSpaceChar(int c){
        if (filter != null){
          return filter.isSpaceChar (c);
        }
        return isWhitespace (c);
      }

      public static boolean isWhitespace(int c){
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }

      private String readLine0(){
        StringBuilder buf = new StringBuilder ();
        int c = read ();
        while (c != '\n' && c != -1){
          if (c != '\r'){
            buf.appendCodePoint (c);
          }
          c = read ();
        }
        return buf.toString ();
      }

      public String nextLine(){
        String s = readLine0 ();
        while (s.trim ().length () == 0)
          s = readLine0 ();
        return s;
      }

      public String nextLine(boolean ignoreEmptyLines){
        if (ignoreEmptyLines){
          return nextLine ();
        }else{
          return readLine0 ();
        }
      }

      public BigInteger nextBigInteger(){
        try{
          return new BigInteger (nextString ());
        } catch (NumberFormatException e){
          throw new InputMismatchException ();
        }
      }

      public char nextCharacter(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        return (char) c;
      }

      public double nextDouble(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        int sgn = 1;
        if (c == '-'){
          sgn = -1;
          c = read ();
        }
        double res = 0;
        while (!isSpaceChar (c) && c != '.'){
          if (c == 'e' || c == 'E'){
            return res * Math.pow (10, nextInt ());
          }
          if (c < '0' || c > '9'){
            throw new InputMismatchException ();
          }
          res *= 10;
          res += c - '0';
          c = read ();
        }
        if (c == '.'){
          c = read ();
          double m = 1;
          while (!isSpaceChar (c)){
            if (c == 'e' || c == 'E'){
              return res * Math.pow (10, nextInt ());
            }
            if (c < '0' || c > '9'){
              throw new InputMismatchException ();
            }
            m /= 10;
            res += (c - '0') * m;
            c = read ();
          }
        }
        return res * sgn;
      }

      public boolean isExhausted(){
        int value;
        while (isSpaceChar (value = peek ()) && value != -1)
          read ();
        return value == -1;
      }

      public String next(){
        return nextString ();
      }

      public SpaceCharFilter getFilter(){
        return filter;
      }

      public void setFilter(SpaceCharFilter filter){
        this.filter = filter;
      }

      public interface SpaceCharFilter{
        public boolean isSpaceChar(int ch);
      }
    }
    /******************** Pair class ***********************/

  class Pair implements Comparable<Pair>{
     public int a;
     public int b;
          public int c;
     public Pair(){
      this.a = 0;
      this.b = 0;
    }
    public Pair(int a,int b, int c){
      this.a = a;
      this.b = b;
      this.c = c;
    }
    public int compareTo(Pair p){
      if(this.a==p.a){
       return this.b-p.b;
     }
     return p.a-this.a;
   }
   public String toString(){
    return "a="+this.a+" b="+this.b;
  }

}

import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		long b = 0, m = 0;

		if (scan.hasNext()) {
			m = scan.nextLong();

		}
		if (scan.hasNext()) {
			b = scan.nextLong();

		}

		long max = 0;

		for (long y = 0; y <= b; y++) {

			// for(long x=0;x<=b*m;x++){

			long x = m * (b - y);
			// long y=(long)((-(float)x/(float)m)+(float)b);
			// if(x==5){
			// System.out.println(y);
			// System.out.println(x/m);
			// }
			long res = (long) (((y + 1) * (x + 1) * (x + y)) / 2);
			if (max < res) {
				max = res;
			}
			// System.out.println(x+","+y+" and the bananas are "+res);

		}

		System.out.println(max);

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Long.max;
import static java.lang.Long.toHexString;
import static java.lang.Math.abs;
import static java.lang.Math.sin;

public class B {

    public static void main(String[] args) {

        MyScanner in = new MyScanner();

        int m = in.nextInt();
        int b = in.nextInt();

        long result = 0;

        for(int x=1;x<=m*b;++x){
            int y = (int)(-1.0*x/m + b);
            result = Math.max(result, 1L*(x+1) * (y)*(y+1)/2 + 1L*(y+1)*(x)*(x+1)/2);
        }

        System.out.println(result);

    }

    // -----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    // --------------------------------------------------------

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Long.max;
import static java.lang.Long.toHexString;
import static java.lang.Math.abs;
import static java.lang.Math.sin;

public class B {

    public static void main(String[] args) {

        MyScanner in = new MyScanner();

        int m = in.nextInt();
        int b = in.nextInt();

        long result = 0;

        for(int x=1;x<=m*b;++x){
            long y = (long)(-1.0*x/m + b);
            result = Math.max(result, 1L*(x+1) * (y)*(y+1)/2 + 1L*(y+1)*(x)*(x+1)/2);
        }

        System.out.println(result);

    }

    // -----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    // --------------------------------------------------------

}

import java.io.*;
import java.util.*;

public class Codeforces {

	public static void  main(String...args) {
		InputReader sc = new InputReader();
		PrintWriter out = new PrintWriter(System.out);
		Thread th = new Thread(null, new Runnable(){public void run(){new Solver().solve(sc,out);}},"Solver",1<<24);
		try{
			th.start();
			th.join();
		} catch(InterruptedException e){}
		out.close();
	}
}

class Solver {

	public long getSum(long x)
	{
		if(x==-1) return 0;
		return x*(x+1)/2;
	}

	public void solve(InputReader sc, PrintWriter out) {
		long m = sc.nextInt();
		long b = sc.nextInt();
		long ans = 0;
		for(long i=0;i<b;i++)
		{
			long j = m*(b-i);
			long sum = 0;
			for(long k=i;k>=0;k--)
			{
				sum += (getSum(k+j)-getSum(k-1));
			}
			ans = Math.max(ans,sum);
		}
		ans = Math.max(ans,getSum(b-1));
		out.println(ans);
	}
}

// class Comp implements Comparator<Pair> {
//     @Override
//     public int compare(Pair o1, Pair o2) {
//         if(o1.ff()/1000 != o2.ff()/1000) return (o1.ff()/1000)-(o2.ff()/1000);
//         else return o1.ss()-o2.ss();
//     }
// }

// class Pair{

// 	public int x1,y1,x2,y2;
// 	public Pair(int x,int y,int z,int w) {
// 		this.x1 = x;
// 		this.y1 = y;
// 		this.x2 = z;
// 		this.y2 = w;
// 	}
// 	@Override
// 	public boolean equals(Object obj) {
// 		if ((this.x1 == (Pair)obj.x1)&&(this.y1 == (Pair)obj.y1)&&(this.x2 == (Pair)obj.x2)&&(this.y2 == (Pair)obj.y2)) return true;
//    		return false;
//    }
// }

class Reader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public Reader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public double nextDouble() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E') {
                return res * Math.pow(10, nextInt());
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null) {
            return filter.isSpaceChar(c);
        }
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class InputReader{
		final InputStream stream;
		final byte[] buf = new byte[8192];
		int curChar, numChars;
		SpaceCharFilter filter;
		public InputReader(){
			this.stream = System.in;
		}
		public int read(){
			if(numChars == -1) throw new InputMismatchException();
			if(curChar >= numChars){
				curChar = 0;
				try{
					numChars = stream.read(buf);
				} catch(IOException e){
					throw new InputMismatchException();
				}
				if(numChars <= 0) return -1;
			}
			return buf[curChar++];
		}
		public int nextInt(){
			int c = read();
			while(isSpaceChar(c)) c = read();
			int sgn = 1;
			if(c == '-'){
				sgn = -1;
				c = read();
			}
			int res = 0;
			do{
				if(c<'0' || c>'9') throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while(!isSpaceChar(c));
			return res*sgn;
		}
		public long nextLong(){
			int c = read();
			while(isSpaceChar(c)) c = read();
			int sgn = 1;
			if(c == '-'){
				sgn = -1;
				c = read();
			}
			long res = 0;
			do{
				if(c<'0' || c>'9') throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while(!isSpaceChar(c));
			return res*sgn;
		}
		public String next(){
			int c = read();
			while(isSpaceChar(c)) c = read();
			StringBuilder res = new StringBuilder();
			do{
				res.appendCodePoint(c);
				c = read();
			}while(!isSpaceChar(c));
			return res.toString();
		}
		public boolean isSpaceChar(int c){
			if(filter != null) return filter.isSpaceChar(c);
			return c==' ' || c=='\n' || c=='\r' || c=='\t' || c==-1;
		}
		public interface SpaceCharFilter{
			public boolean isSpaceChar(int ch);
		}
}

/**
 * DA-IICT
 * Author : Savaliya Sagar
 */
import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class B821 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int m;
	int b;
	void solve() {
		m = ni();
		b = ni();
		long ans = 0;
		for(int i=0;i<=m*b;i++){
			ans = max(ans,f(i));
		}
		out.println(ans);
	}

	double ts(double left,double right,double absoluteprecision){
		while(true){
			//left and right are the current bounds; the minimum is between them
			if(right-left<absoluteprecision)
	    	   return (left + right)/2;
	       double leftThird = left + (right - left)/3;
	       double rightThird = right - (right - left)/3;

	        if(f(leftThird) < f(rightThird))
	            left = leftThird;
	        else
	            right = rightThird;
	        }
	}

	long f(double x){
		double y = -x/m + b;
		if(y<0)
			return 0;
		long p = (long)x;
		long q = (long)y;
		long ans = ((p*(p+1))/2)*(q+1) + ((q*(q+1))/2)*(p+1);
		return ans;
	}

	long f2(double y){
		double x = m*(b-y);
		if(y<0)
			return 0;
		long p = (long)x;
		long q = (long)y;
		long ans = ((p*(p+1))/2)*(q+1) + ((q*(q+1))/2)*(p+1);
		return ans;
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new B821().run();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b !=
										// ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

import java.io.*;
import java.util.*;

public class Main {
    public static void main (String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int m = Integer.parseInt(st.nextToken()),
            b = Integer.parseInt(st.nextToken());
        long max = 0;
        for (int y=b ; y>=0 ; y--) {
            long x = (long)Math.floor(((double)y-b)*(-m));
            long current = 0;
            for (int i=y ; i>=0 ; i--) {
                current += (i+x)*(i+x+1)/2 - (long)(i-1)*(i)/2;
            }
            max = Math.max(max, current);
        }
        System.out.println(max);
    }
}

import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
public class code
{
    public static long sum(long x, long y)
    {
        return (x+1)*(y+1)*(x+y)/2;
    }
    public static void main(String[] args) throws IOException
    {
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       StringTokenizer st = new StringTokenizer(br.readLine());
       int m = Integer.parseInt(st.nextToken());
       int b = Integer.parseInt(st.nextToken());
       long max = Long.MIN_VALUE;
       for(int i = 0; i<m*b+1; i++)
       {
          long x= i;
          long y = (long) (-1.0*x/((double) m)+b);
          x = m*b-m*y;
          if(sum(x,y)>max)
          {
              max = sum(x,y);
          }
       }
       System.out.println(max);
    }
}

import java.io.FileInputStream;
import java.util.Scanner;

public class P2 {
	public static void main(String[] args) throws Exception{
		//System.setIn(new FileInputStream("input.txt"));
		Scanner scanner = new Scanner(System. in);
		int m = scanner.nextInt();
		int b = scanner.nextInt();

		//int maxX = b*m;
		//int maxY = b;
		//long maxX = b*m;
		//long maxY = b;
		//long max = 0;

		//for(long x = 0; x <= maxX; x++){
		//	for(long y = 0; y <= maxY; y++){
		//		double a = b - ((double)x/m);
		//		double yDouble = y;
		//		if(yDouble <= a){
		//			long xSum = x*(x+1)/2;
		//			long ySum = y*(y+1)/2;
		//			long result = (y+1)*(xSum) + (x+1)*(ySum);
		//			if(result >= max){
		//				max = result;
		//			}
		//		}
		//	}
		//}
		//System.out.println(max);
		// FIX Y
		long max = 0;
		for(long y = b; y >= 0; y--){
			//calculate x
			long x = ((b-y)*m);
			long result = 0;

			long xSum = x*(x+1)/2;
			long ySum = y*(y+1)/2;
			result = (y+1)*(xSum) + (x+1)*(ySum);

			if(result > max){
				max = result;
			}
		}
		// fix X
		for(long x = m*b; x >= 0; x--){
			//calculate x
			long y =  (long) Math.floor(b-(double)x/m);
			long result = 0;

			long xSum = x*(x+1)/2;
			long ySum = y*(y+1)/2;
			result = (y+1)*(xSum) + (x+1)*(ySum);

			if(result > max){
				max = result;
			}
		}
		System.out.println(max);

	}
}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	Scanner in;
	PrintStream out;

	public void run(){
		long m = in.nextInt();
		long b = in.nextInt();
		long maxRes=0;

		for(int y=0; y <= b; y++){
			long  x = (b-y)*m;
			long currRes = ((x+1)*x*(y+1) + (y+1)*y*(x+1))/2;
			maxRes = Math.max(maxRes, currRes);
			//out.println(x+" "+y+" "+currRes);
		}
		/*
		for(int x=0; x <= b*m; x++){
			Double  preY = b-x*1.0/m;
			long y = preY.intValue();
			long currRes = ((x+1)*x*(y+1) + (y+1)*y*(x+1))/2;
			maxRes = Math.max(maxRes, currRes);
			//out.println(x+" "+y+" "+currRes);
		}
		*/
		out.println(maxRes);
		// close _in_ and _out_
		in.close();
		out.close();
	}

	public Main(InputStream in, OutputStream out){
		this.in = new Scanner(new BufferedInputStream(in));
		this.out = new PrintStream(new BufferedOutputStream(out));
	}

	public static void main(String[] args){
		new Main(System.in, System.out).run();
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Amine
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastInput in = new FastInput(inputStream);
        FastOutput out = new FastOutput(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastInput in, FastOutput out) {
            long m = in.nextLong();
            long b = in.nextLong();
            long max = 0;
            for (long i = 0; i < m * b + 1; i++) {
                double lim = (double) -i / (double) m;
                lim += b;
                long y = (int) Math.floor(lim);
                long res = res(i, y);
                if (res > max) {
                    max = res;
                }
            }
            out.println(max);

        }

        public long res(long x, long y) {
            return ((x * (x + 1) * (y + 1) / 2) + (y * (y + 1) * (x + 1) / 2));
        }

    }

    static class FastInput {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastInput.SpaceCharFilter filter;

        public FastInput(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class FastOutput {
        private final PrintWriter writer;

        public FastOutput(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public FastOutput(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }
}

// package CF;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B821 {

	static long sum(long x) {
		return x*(x+1)/2;
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		int m = in.nextInt();
		int b = in.nextInt();

		long xmax = m*b;
		long ans = 0;
		for(long x=0;x<=xmax;x++) {
			long y = (long)(-x/(m*1.0)+b);
//			System.out.println(y);
			long bananas = sum(x)*(y+1)+sum(y)*(x+1);
			ans = Math.max(ans, bananas);
		}
		System.out.println(ans);

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean nxtEmpty() throws IOException {
			String line = br.readLine();
			if (line == null || line.isEmpty())
				return true;
			st = new StringTokenizer(line);
			return false;
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.util.*;
public class OkabeAndBananaTree {
    public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    long m=sc.nextInt();
    long b=sc.nextInt();
    long x=m*b;
    long y=b;

   long count1=0;
    for(int i=0;i<=x;i++){
        long l=(int)((float)b-(float)((float)i/(float)m));
        count1=Math.max(count1,(i+1)*(l+1)*(i+l)/2);
    }

    System.out.println(count1);
    }
}

import java.io.*;
import java.util.*;

public class Kek {

    static class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        void updtokin() throws IOException {
            if (!tokin.hasMoreTokens()) {
                String a = in.readLine();
                if (a != null) {
                    tokin = new StringTokenizer(a);
                }
            }
        }

        String next() throws IOException {
            updtokin();
            return tokin.nextToken();
        }

        int nextInt() throws IOException {
            updtokin();
            return Integer.parseInt(tokin.nextToken());
        }
    }

    void slave() throws IOException {
        Reader in = new Reader();
        long m = in.nextInt();
        long b = in.nextInt();
        long ans = 0;
        for (long y = 0; y <= b; y++) {
            long x = (b - y) * m;
            long a = x * (x + 1) / 2;
            long sum = ((a * 2 + y * (x + 1)) * (y + 1)) / 2;
            if (sum > ans)
                ans = sum;
        }
        System.out.print((long) ans);
    }

    public static void main(String args[]) throws IOException {
        new Kek().slave();
        //PrintWriter out = new PrintWriter(new FileWriter("bits.out"));
        //out.close();
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Toni Rajkovski
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int m = in.nextInt();
            int b = in.nextInt();

            long maxX = m * b;

            long max = 0;
            for (long y = 0; y <= b; y++) {
                long x = binSearch(m, y, maxX);
                long l = (x + 1) * y * (y + 1) / 2 + (y + 1) * x * (x + 1) / 2;
                if (l > max) max = l;

            }
            out.print(max);
        }

        static long binSearch(long m, long y, long maxX) {
            long min = 0, max = maxX, x;

            while (min < max) {
                x = (max - min + 1) / 2 + min;
                if (m * y + x > maxX) max = x - 1;
                else if (m * y + x < maxX) min = x;
                else return x;
            }
            return max;
        }

    }
}

//package com.daimens.algorithm.codeforce.round23;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		int m = in.nextInt();
		int b = in.nextInt();
		long max = 0;
		for (long x = 0; x <= m * b; ++x){
			int y = b - (int)Math.ceil(x / (m * 1.0));
			max = Math.max(max, sum(x,y));
		}
//		int x = m * b / 2;
//		max = Math.max(max, sum(x,b - (int)Math.ceil(x / (m * 1.0))));
//		max = Math.max(max, sum(x + 1, b - (int)Math.ceil((x + 1) / (m * 1.0))));
//		max = Math.max(max, sum(x - 1, b - (int)Math.ceil((x - 1) / (m * 1.0))));
		System.out.println(max);
	}

	public static long sum(long x, long y){
		long sum = 0;
		sum += (x + 1) * (y * (y + 1)) / 2;
		sum += y * (x * (x + 1)) / 2;
		sum += x * (x + 1) / 2;
		return sum;
	}

	static class Scanner {

		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
			getLine();
		}

		private void getLine() throws IOException {
			while (tok == null || !tok.hasMoreTokens()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok.hasMoreTokens();
		}

		public String next() throws IOException {
			if (hasNext()) {
				return tok.nextToken();
			} else {
				getLine();
				return tok.nextToken();
			}
		}

		public int nextInt() throws IOException {
			if (hasNext()) {
				return Integer.parseInt(tok.nextToken());
			} else {
				getLine();
				return Integer.parseInt(tok.nextToken());
			}
		}

		public long nextLong() throws IOException {
			if (hasNext()) {
				return Long.parseLong(tok.nextToken());
			} else {
				getLine();
				return Long.parseLong(tok.nextToken());
			}
		}

		public double nextDouble() throws IOException {
			if (hasNext()) {
				return Double.parseDouble(tok.nextToken());
			} else {
				getLine();
				return Double.parseDouble(tok.nextToken());
			}
		}
	}
}

import java.util.*;
import java.io.*;

public class eighttwooneb {
  public static void main(String[] args) throws IOException {
    Scanner in = new Scanner(System.in);
    int m=in.nextInt();
    int b=in.nextInt();
    //triangle interior has inequality my+x<=b
    long max=0;
    int x;
    for (int y=b; y>=0; y--){
      x=m*b-m*y;
      max=Math.max(BANANAS(x,y),max);
    }
    System.out.println(max);
  }
  public static long BANANAS(int width, int height){
    return (long)(width+1)*(height+1)*(width+height)/2;
  }
}

import java.util.*;

public class Darshjava
{
    public static void main(String args [])
    {
        Scanner enter = new Scanner (System.in) ;
        long m = enter.nextInt() , b = enter.nextInt()
        , x = m * b , y ;
        long bananas = 0 , max = 0 ;
        for (y = 0 ; y <= b ; y++)
        {
            x = (b-y)* m ;
            bananas = x*(x+1)/2* (y+1) + y*(y+1)/2 *(x+1) ;
            max = max > bananas ? max : bananas ;
            bananas = 0 ;
        }
        System.out.println(max);
    }
}

import java.util.Scanner;

public class OkabeandBananaTree {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner input = new Scanner(System.in);
		int m = input.nextInt();
		int b = input.nextInt();

		long total=0;
		for(int y=b; y>=0;y--){
			long x = m*(b-y);
			total = Math.max(total,(x+1)*series(y)+(y+1)*series(x));
		}
		System.out.println(total);

	}

	private static long series(long x){
		return  x*(x+1)/2;
	}

}

import java.math.BigInteger;
import java.util.Scanner;

public class jygub {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int m=sc.nextInt();
		int b=sc.nextInt();
		long max=Integer.MIN_VALUE;
		long y=0;
		long x=0;
		long f=0;
		for(y=0;y<=b;y++)
		{
			x=m*(b-y);
			f=0;
			f=(x+1)*(((y)*(y+1))/2)+(y+1)*((x*(x+1))/2);
		    max=Math.max(f,max);
		}
		System.out.println(max);

	}

}

	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.io.PrintWriter;
	import java.util.ArrayList;
	import java.util.Arrays;
	import java.util.Map.Entry;
	import java.util.PriorityQueue;
	import java.util.StringTokenizer;
	import java.util.*;

	   public class Solution {

		/*public static int ispr(int n)
	    	{
	    	//boolean[] isPrime = new boolean[n+1];
	        for (int i = 2; i <= n; i++) {
	            Prime[i] = true;
	        }

	        // mark non-primes <= n using Sieve of Eratosthenes
	        for (int factor = 2; factor*factor <= n; factor++) {

	            // if factor is prime, then mark multiples of factor as nonprime
	            // suffices to consider mutiples factor, factor+1, ...,  n/factor
	            if (Prime[factor]) {
	                for (int j = factor; factor*j <= n; j++) {
	                    Prime[factor*j] = false;
	                }
	            }
	        }
	        // count primes

	        /*int primes = 0;
	        for (int i = 2; i <= n; i++) {
	            if (isPrime	[i])System.out.println(i);

	        }*/
		// System.out.println("The number of primes <= " + n + " is " + primes);
		//return 0;
		// if(isPrime[n]==true)return 1; else return 0;

		//}

		public static long fact(long x)
		{
			if(x==0)return 1;
			else return x*fact(x-1);
		}

		public static long exp(long x, long n, long M)
		{

			if(n==0) return 1;

			else if(n%2==0) return exp((x*x)%M,n/2,M);
			else return (x*exp((x*x)%M,(n-1)/2,M))%M;

		}

		//fi

		static long fib(long n)
		{
			long F[][] = new long[][]{{1,1},{1,0}};
			if (n == 0)
				return 0;
			power(F, n-1);

			return F[0][0];
		}

		static int mod=1000000007;

		static void multiply(long F[][], long M[][])
		{
			long x =  (((F[0][0]%mod)*(M[0][0]%mod))%mod + ((F[0][1]%mod)*(M[1][0]%mod))%mod)%mod;
			long y =  (((F[0][0]%mod)*(M[0][1]%mod))%mod + ((F[0][1]%mod)*(M[1][1]%mod))%mod)%mod;
			long z =  (((F[1][0]%mod)*(M[0][0]%mod))%mod + ((F[1][1]%mod)*(M[1][0]%mod))%mod)%mod;
			long w =  (((F[1][0]%mod)*(M[0][1]%mod))%mod + ((F[1][1]%mod)*(M[1][1]%mod))%mod)%mod;

			F[0][0] = x;
			F[0][1] = y;
			F[1][0] = z;
			F[1][1] = w;
		}

		/* Optimized version of power() in method 4 */
		static void power(long F[][], long n)
		{
			if( n == 0 || n == 1)
				return;
			long M[][] = new long[][]{{1,1},{1,0}};

			power(F, n/2);
			multiply(F, F);

			if (n%2 != 0)
				multiply(F, M);
		}

		public static int gcd(int a, int b)
		{
			if(b==0)
				return a;
			else return gcd(b,a%b);
		}

		static  class MyScanner {

			BufferedReader br;
			StringTokenizer st;

			public MyScanner() {
				br = new BufferedReader(new InputStreamReader(System.in));
			}

			String next() {
				while (st == null || !st.hasMoreElements()) {
					try {
						st = new StringTokenizer(br.readLine());
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}

			int nextInt() {
				return Integer.parseInt(next());
			}

			long nextLong() {
				return Long.parseLong(next());
			}

			double nextDouble() {
				return Double.parseDouble(next());
			}

			String nextLine(){
				String str = "";
				try {
					str = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				return str;
			}

		}

		static MyScanner sc = new  MyScanner();
		static PrintWriter pw = new PrintWriter(System.out, true);

		static void printPath(int parent[], int j)
		{
		    // Base Case : If j is source
		    if (parent[j]==-1)
		        {pw.print(j+" ");return;}

		    printPath(parent, parent[j]);

		    pw.print(j+" ");
		}

		//Main begins here :)
	/*
		public static class Pair{
		    int a;
		    int b;
		    Pair(int p,int q){
		        a=p;
		        b=q;
		    }
		    public boolean equals(Object o) {
		        if (o instanceof Pair) {
		            Pair p = (Pair)o;
		            return p.a == a && p.b == b;
		        }
		        return false;
		    }
		    public int hashCode() {
		        return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		    }
		}
		*/

		public static int max1(String st, int k)
		{
			int n1=0;
			int max=Integer.MIN_VALUE;
			int n = st.length();
			if(n==1)
			{
				if(st.charAt(0)=='1')return 1;
				else return 0;
			}

			for(int i=1;i<=k;i++)
			{
				int chp=i-1;

				if(st.charAt(chp)=='1')n1++;

			}
			max=Math.max(max, n1);
		//	if(k>=n)return max;
			int slides=n-k;
			int ptr1=0, ptr2=k-1;

			for(int i=1;i<=slides;i++)
			{
				//pw.println(st.substring(ptr1+i, ptr2+i+1));
				ptr1++; ptr2++;
				if(st.charAt(ptr1-1)=='1')n1--;
				if(st.charAt(ptr2)=='1')n1++;
				//pw.println("m1- "+n1);pw

				if(n1>max)max=n1;
				if(max==k){return k;}
			}

			return max;

		}

		public static String shift(String A)
		{
			char lc = A.charAt(A.length()-1);
			return lc+A.substring(0,A.length()-1);

		}

		static  class Point
		{
			long x,y;

			public Point(long a, long b)
			{
				x=a;
				y=b;
			}

			public int compareTo(Point o) {
				// TODO Auto-generated method stub
				return Long.compare(this.x, o.x);

			}

		}

		static class compx implements Comparator<Point>
		{
			public int compare(Point a, Point b)
			{

				if(a.x>b.x)return 1;
				if(a.x<b.x) return -1;

				return 0;
			}
		}

		static class compy implements Comparator<Point>
		{
			public int compare(Point a, Point b)
			{

				if(a.y>b.y)return 1;
				if(a.y<b.y) return -1;

				return 0;
			}
		}

		public static int lucky(long y)
		{

			long d = y;
			int flg=0;
			//long nd = (long)Math.floor(Math.log10((double)y));
			//pw.println(nd);
			for(;d>=1;d=d/10)
			{
				long dg = d%10;
				if(dg!=0)flg++;
				if(flg==2)return 0;

			}
			return 1;

		}

		public static int diff(Time n, Time k)
		{

			int hn=n.h,mn=n.m,sn=n.s;
			int hk=k.h,mk=k.m,sk=k.s;

			int tc=0,cs=0,cm=0,ch=0;
			if(sk>sn)
			{
				int o1 = sk-sn;
				int o2 = sn+60-sk;

				if(o1>o2)
				{
					cs=o2;
					mn--;
				}
				if(o2>o1)
				{
					cs=o1;
				}
				if(o1==o2)
				{

					int min1 = Math.min(Math.abs(mk-mn), 60 - Math.abs(mk-mn));
					int mn2 = mn-1;
					int min2  = Math.min(Math.abs(mk-mn2), 60 - Math.abs(mk-mn2));
					if(min2<min1)
					{
						cs=o2;
						mn--;
					}
					else
					{
						cs=o1;
					}

				}
			}

			if(sk<sn)
			{
				int o1 = sn-sk;
				int o2 = sk+60-sn;

				if(o1>o2)
				{
					cs=o2;
					mn++;
				}
				if(o2>o1)
				{
					cs=o1;
				}
				if(o1==o2)
				{

					int min1 = Math.min(Math.abs(mk-mn), 60 - Math.abs(mk-mn));
					int mn2 = mn+1;
					int min2  = Math.min(Math.abs(mk-mn2), 60 - Math.abs(mk-mn2));
					if(min2<min1)
					{
						cs=o2;
						mn++;
					}
					else
					{
						cs=o1;
					}

				}
			}

			if(mk>mn)
			{
				int o1 = mk-mn;
				int o2 = mn+60-mk;

				if(o1>o2)
				{
					cm=o2;
					hn--;
				}
				if(o2>o1)
				{
					cm=o1;
				}
				if(o1==o2)
				{
					int min1 = Math.min(Math.abs(hk-hn), 24 - Math.abs(hk-hn));
					int hn2 = hn-1;
					int min2  = Math.min(Math.abs(hk-hn2), 24 - Math.abs(hk-hn2));
					if(min2<min1)
					{
						cm=o2;
						hn--;
					}
					else
					{
						cm=o1;
					}
				}
			}

			if(mk<mn)
			{
				int o1 = mn-mk;
				int o2 = mk+60-mn;

				if(o1>o2)
				{
					cm=o2;
					hn++;
				}
				if(o2>o1)
				{
					cm=o1;
				}
				if(o1==o2)
				{
					int min1 = Math.min(Math.abs(hk-hn), 24 - Math.abs(hk-hn));
					int hn2 = hn+1;
					int min2  = Math.min(Math.abs(hk-hn2), 24 - Math.abs(hk-hn2));
					if(min2<min1)
					{
						cm=o2;
						hn++;
					}
					else
					{
						cm=o1;
					}
				}
			}

			ch = Math.min(Math.abs(hk-hn), 24 - Math.abs(hk-hn));
			tc=cs+cm+ch;
			return tc;

			//return 3;
		}

		public static class Time
		{
			int h,m,s;

			public Time(int x, int y, int z)
			{
				h=x; m=y; s=z;

			}

		}

		static class Pair
		{
		    int x;
		    int y;

		    public Pair(int a , int b)
		    {
		        x=a;
		        y=b;
		    }

		}

		static class comp implements Comparator<Pair>
		{

		    @Override

		    public int compare(Pair a ,Pair b)
		    {
		        if(b.x>a.x)return -1;
		        if(b.x<a.x)return 1;
		        return 0;

		    }

		}
		static class compv implements Comparator<Vouch>
		{

		    @Override

		    public int compare(Vouch a ,Vouch b)
		    {
		        if(b.c>a.c)return -1;
		        if(b.c<a.c)return 1;
		        return 0;

		    }

		}

		static class Vouch
		{
		   int l,r, c;

		    public Vouch(int a ,int b, int ci)
		    {
		        l=a;
		        r=b;
		        c=ci;

		    }

		}

		public static int strStr(final String haystack, final String needle) {

			if(needle.equals("")) return -1;
		    if(haystack.equals("")&&needle.equals(""))return -1;

		    String temp="";

		    int hl = haystack.length();
		    int nl = needle.length();
		    if(nl>hl) return -1;
		    int ret=-1;
	        String wind = haystack.substring(0,nl);
	        pw.println(wind);
	        if(wind.equals(needle)) return 0;

	        for(int i=1;i<hl-nl;i++)
	        {
	            wind = wind.substring(1, wind.length());

	            wind = wind+haystack.charAt(i+nl);

	            pw.println(i+" "+wind);
	            if(wind.equals(needle))
	            {
	                ret=i; break;
	            }

	        }

	        return (ret==-1)?-1:ret;

			}

		public static int diff(String a, String b)
		{
			int ret=0;
			for(int i=0;i<a.length();i++)
			{
				if(a.charAt(i)!=b.charAt(i))ret++;
			}
			return ret;
		}

		public static boolean inter(Vouch a, Vouch b)
		{
			//return true if there's intersection
			int s1 = a.l;
			int e1 = a.r;

			int s2 = b.l;
			int e2 = b.r;

			if(s1<s2)
			{
				if(e1>=s2)return true;
				else return false;
			}
			else if(s1>s2)
			{
				if(e2>=s1) return true;
				else return false;
			}
			else
			{
				return true;
			}

		}
		public static void main(String[] args) {

			long m = sc.nextInt();
			long b = sc.nextInt();
			long max = Long.MIN_VALUE;
			for(int x=0;x<=m*b;x+=m)
			{

					long y = b - (x/m);
					//y=(int) Math.floor(y);
					while(y>=0)
					{
					long area = (((y+1)*(x)*(x+1))/2)+(((x+1)*(y+1)*y)/2);
					max=Math.max(max, area);
					y--;
					}
			}
			pw.println(max);

			    pw.close();

		}

	}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by mostafa on 7/8/17.
 */
public class B {
    static int[][] g;
    static long[][] acc;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner();
        int m = sc.nextInt(), b = sc.nextInt();

        long max = 0;
        int h = b;
        while(h >= 0) {
            int ans = -1;
            int low = 0;
            int high = b * m;
            while(low <= high) {
                int mid = (low + high) / 2;
                double y = -mid + b * m;
                if(h * m <= y) {
                    ans = mid;
                    low = mid + 1;
                }
                else {
                    high = mid - 1;
                }
            }

            if(ans != -1) {

                long tmp = (long)(ans + 1) * (h) * (h + 1) / 2 + (long)(h + 1) * (ans) * (ans + 1) / 2;
                max = Math.max(max, tmp);
            }
            h--;
        }

        System.out.println(max);
    }

    static class Scanner {
        BufferedReader br; StringTokenizer st;
        Scanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while(st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

    }
}

//package _821;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

/**
 * Created by ridik on 10.07.2017.
 */
public class Main {
    public static void main(String[] args) throws FileNotFoundException {
        //Scanner sc = new Scanner(new FileReader("input.txt"));
        Scanner sc = new Scanner(System.in);
        long maxBananas = 0,tempSum=0,tempSumZero = 0;
        long m = sc.nextLong(),b = sc.nextLong();
        for(long i = 0; i <= b*m;i++)
        {
            while (integerY(i,m,b)==integerY(i+1,m,b))
                i++;
            tempSum =  ((0 + (0 + integerY(i,m,b)))*(integerY(i,m,b)+1)/2 + (i + ( i + (integerY(i,m,b))))*(integerY(i,m,b)+1)/2)*(i+1)/2;
            maxBananas = Math.max(maxBananas,tempSum);
        }
        System.out.println(maxBananas);
    }
    private static long integerY(long x,long m,long b){
        return (long)Math.floor(-((float)x/m)+b);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        int m;
        int b;

        double fx(long x) {
            return -1.0 * x / m + b;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            m = in.nextInt();
            b = in.nextInt();

            long max = 0;
            for (long x = 1; ; x++) {
                double vfx = fx(x);
                long y = (long) vfx;
                if (vfx < 0)
                    break;
                max = Math.max(max, (y + 1) * y / 2L * (x + 1) + (x + 1) * x / 2L * (y + 1));
            }
            out.println(max);
        }

    }

    static class InputReader {
        StringTokenizer st;
        BufferedReader br;

        public InputReader(InputStream is) {
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            this.br = br;
        }

        public String next() {
            if (st == null || !st.hasMoreTokens()) {
                String nextLine = null;
                try {
                    nextLine = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (nextLine == null)
                    return null;
                st = new StringTokenizer(nextLine);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;
import java.util.Scanner.*;
import java.io.*;
import java.util.Arrays;
import java.math.*;
import java.math.BigInteger.*;
import java.math.BigDecimal.*;
import java.util.Set.*;

public class Main
{
    public static void main(String[] args)throws  IOException{

        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        Scanner sc= new Scanner (System.in);
         long m,n,b,s=0,x;
         m=sc.nextInt();
         b=sc.nextInt();
        for(int i=0;i<=b;i++){
            x=(b-i)*m;
            s=Math.max(s,((i+1)*(x+1)*(i+x))/2);
        }
        System.out.println(s);
    }
}

import java.util.*;
public class may1{
	public static void main(String s[]){

		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int b = sc.nextInt();
		long max = Integer.MIN_VALUE;
		for(int y=b;y>=0;y--){
			long x = m*(b-y);
			long ans= (sum(x)*(y+1))+(sum(y)*(x+1));
			max = Math.max(ans,max);
		}
		System.out.println(max);
	}
	public static long sum(long x){
		return (x*(x+1))/2;
	}
}

import java.util.*;
import java.io.*;
public class Okabe_and_Banana_Trees
{
	public static void main(String args[]) throws Exception
	{
		BufferedReader f=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer(f.readLine());
		int slope=Integer.parseInt(st.nextToken());
		int intercept=Integer.parseInt(st.nextToken());
		long xpos=0;
		long ypos=intercept;
		long ans=0;
		while(ypos>=0)
		{
			long temp=0;
			for(int x=0;x<=ypos;x++)
				temp+=(xpos+x)*(xpos+x+1)/2-x*(x-1)/2;
			ans=Math.max(ans,temp);
			ypos--;
			xpos+=slope;
		}
		System.out.println(ans);
	}
}

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

public class B {

  private static final String REGEX = " ";
  private static final Boolean DEBUG = false;
  private static final String FILE_NAME = "input.txt";

  public static void main(String[] args) throws IOException {
    if (DEBUG) {
      generate();
    }
    Solver solver = new Solver();
    solver.readData();
    solver.solveAndPrint();
  }

  private static void generate() throws IOException {
//    FileWriter writer = new FileWriter("input.txt");
//    writer.close();
  }

  private static class Solver {
    long m, b;

    void readData() throws IOException {
      InputStream in = DEBUG ? new FileInputStream(FILE_NAME) : System.in;
      Scanner scanner = new Scanner(in);
      m = scanner.nextLong();
      b = scanner.nextLong();
      scanner.close();
    }

    void solveAndPrint() {
      long answer = 0;
      long y = b;
      long x = 0;
      while (true) {
        while (x <= m * (b - y)) {
          x++;
        }
        x--;
        answer = max(answer, getRes(x, y));
        y--;
        if (y < 0) {
          break;
        }

      }
      System.out.println(answer);
    }

    private long getRes(long x, long y) {
      if (y % 2 == 1) {
        return (y + 1) / 2 * (y + x) * (x + 1);
      } else if (x % 2 == 1) {
        return (x + 1) / 2 * (y + x) * (y + 1);
      } else {
        return (x + y) / 2 * (x + 1) * (y + 1);
      }
    }

    @SuppressWarnings("SameParameterValue")
    int[] splitInteger(String string, int n) {
      final String[] split = string.split(REGEX, n);
      int[] result = new int[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Integer.parseInt(split[i]);
      }
      return result;
    }

    public int[] splitInteger(String string) {
      return splitInteger(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    long[] splitLong(String string, int n) {
      final String[] split = string.split(REGEX, n);
      long[] result = new long[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Long.parseLong(split[i]);
      }
      return result;
    }

    public long[] splitLong(String string) {
      return splitLong(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    double[] splitDouble(String string, int n) {
      final String[] split = string.split(REGEX, n);
      double[] result = new double[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Double.parseDouble(split[i]);
      }
      return result;
    }

    public double[] splitDouble(String string) {
      return splitDouble(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    String[] splitString(String string, int n) {
      return string.split(REGEX, n);
    }

    public String[] splitString(String string) {
      return splitString(string, 0);
    }

    public int max(int a, int b) {
      return Math.max(a, b);
    }

    public long max(long a, long b) {
      return Math.max(a, b);
    }

    public int min(int a, int b) {
      return Math.min(a, b);
    }

    public long min(long a, long b) {
      return Math.min(a, b);
    }

    public double max(double a, double b) {
      return Math.max(a, b);
    }

    public double min(double a, double b) {
      return Math.min(a, b);
    }

    private final static int MOD = 1000000009;

    int multMod(int a, int b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    int sumMod(int a, int b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }

    long multMod(long a, long b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    long sumMod(long a, long b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }
  }

}

import java.util.*;
import java.io.*;
import java.math.*;
public final class Solution
{
	static int mod1 = (int)Math.pow(10, 9) + 7;
	static BigInteger mod = new BigInteger(mod1 + "");
    public static void main(String[] args)
    {
    	 Reader input = new Reader();
         PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
         int m = input.nextInt(), b = input.nextInt();
         int xIntersection = b * m , yIntersection = b ;
         double x ;
         long result = 0;
         for(int i = yIntersection ; i >= 0 ; i--)
         {
        	 x = (b - i) * m;
        	 if(Math.abs(x - (int)x) <= 0.0001)
        	 {
        		 if((int)x + i > result)
        			 result = (long)x + i;
        	 }
         }
         long sumX = 0;
         for(int i = 1 ; i <= xIntersection ; i++)
         {
        	 sumX += i;
        	 long y = b - (i / m);
        	 if(Math.abs(y - ((double)b - (i / (double)m))) > 0.0001)
        		 continue;
        	 long bananas = sumX * (y+1) + (y+1) * y / 2 * (i+1);
        	 if(bananas > result)
        		 result = bananas;
         }
         long sumY = 0;
         for(int i = 1 ; i <= yIntersection ; i++)
         {
        	 sumY += i;
        	 long x1 = (b - i) * m;
        	 long bananas = sumY * (x1+1) + (x1+1) * x1 / 2 * (i+1);
        	 if(bananas > result)
        		 result = bananas;
         }
         out.println(result);
         out.close();
    }
    public static class Reader
    {
    	BufferedReader br;
    	StringTokenizer st;
    	public Reader()
    	{
    		br = new BufferedReader(new InputStreamReader(System.in));
    	}
    	public String next()
    	{
    		try
    		{
        		if(st == null || !st.hasMoreTokens())
        			st = new StringTokenizer(br.readLine());
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return st.nextToken();
    	}
    	public int nextInt()
    	{
    		return Integer.parseInt(next());
    	}
    	public double nextDouble()
    	{
    		return Double.parseDouble(next());
    	}
    	public long nextLong()
    	{
    		return Long.parseLong(next());
    	}
    	public String nextLine()
    	{
    		try
    		{
    			return br.readLine();
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return "";
    	}
    }
}

/*

        HARSH KHATRI
        DA-IICT

                      */

import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

public class CF821B {

    static FasterScanner in = new FasterScanner();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {

        long x, y, m = in.nextLong(), b = in.nextLong();
        long ans = 0;

        y = 0; x = m*b;
        while(y<=b) {
            ans = Math.max(ans, (x+y)*(x+1)*(y+1) );
            y++; x-=m;
        }

        ans >>= 1;
        out.println(ans);
        out.close();
    }
}

class Pair implements Comparator<Pair> {

    int x;
    int y;

    Pair() {}

    Pair(int a, int b) {
        x = a;
        y = b;
    }

    @Override
    public int compare(Pair p, Pair q) {
        return (p.y-q.y);
    }

    @Override
    public boolean equals(Object object) {

        if(object!=null && object instanceof Pair) {
            return (this.x==((Pair)object).x && this.y==((Pair)object).y);
        }

        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}

class FasterScanner {
    private byte[] buf = new byte[1024];
    private int curChar;
    private int snumChars;

    public int read() {
      if (snumChars == -1)
    throw new InputMismatchException();
      if (curChar >= snumChars) {
    curChar = 0;
    try {
      snumChars = System.in.read(buf);
    } catch (IOException e) {
      throw new InputMismatchException();
    }
    if (snumChars <= 0)
      return -1;
      }
      return buf[curChar++];
    }

    public double nextDouble() {
      return Double.parseDouble(this.nextString());
    }

    public String nextLine() {
      int c = read();
      while (isSpaceChar(c))
    c = read();
      StringBuilder res = new StringBuilder();
      do {
    res.appendCodePoint(c);
    c = read();
      } while (!isEndOfLine(c));
      return res.toString();
    }

    public String nextString() {
      int c = read();
      while (isSpaceChar(c))
    c = read();
      StringBuilder res = new StringBuilder();
      do {
    res.appendCodePoint(c);
    c = read();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public long nextLong() {
      int c = read();
      while (isSpaceChar(c))
    c = read();
      int sgn = 1;
      if (c == '-') {
    sgn = -1;
    c = read();
      }
      long res = 0;
      do {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int nextInt() {
      int c = read();
      while (isSpaceChar(c))
    c = read();
      int sgn = 1;
      if (c == '-') {
    sgn = -1;
    c = read();
      }
      int res = 0;
      do {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int[] nextIntArray(int n) {
      int[] arr = new int[n];
      for (int i = 0; i < n; i++) {
    arr[i] = nextInt();
      }
      return arr;
    }

    public long[] nextLongArray(int n) {
      long[] arr = new long[n];
      for (int i = 0; i < n; i++) {
    arr[i] = nextLong();
      }
      return arr;
    }

    private boolean isSpaceChar(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
      return c == '\n' || c == '\r' || c == -1;
    }
}

import java.io.*;
import java.util.*;

public class Main
{
    static BufferedReader in;
    static PrintWriter out;
    static boolean nOut = true;

    static void solve() throws Exception{
        long m = nextInt();
        long b = nextInt();
        long maxBananov = 0;
        for (long i = b; i >= 0; i--)
        {
            long peresecheniePramoySGraphicom_X = m*(b-i);
            long banani = 0;
            long sumY;
            if(i % 2 == 0)
                sumY = ((i+1)*i/2)*(peresecheniePramoySGraphicom_X+1);
            else
                sumY = ((i+1)/2*i)*(peresecheniePramoySGraphicom_X+1);
            long sumX;
            if(peresecheniePramoySGraphicom_X % 2 == 0)
                sumX = (i+1)*(peresecheniePramoySGraphicom_X/2*(peresecheniePramoySGraphicom_X+1));
            else
                sumX = (i+1)*((peresecheniePramoySGraphicom_X+1)/2*peresecheniePramoySGraphicom_X);
            banani+=sumY;
            banani+=sumX;
            if(banani > maxBananov) maxBananov = banani;
        }

        out.print(maxBananov);

    }

    static class MyQueue{
        int maxSize;
        int[] array;
        int head;
        int tail;
        int nItems;

        public MyQueue(int maxSize){
            this.maxSize = maxSize;
            array = new int[maxSize];
            head = 0;
            tail = 0;
            nItems = 0;
        }

        public void push(int x){

        }
    }

    public static void main(String[] args) throws Exception
    {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        if(nOut)
            out.flush();
    }

    static boolean isSpaceChar(char c){
        return c == ' ' || c == '\n' || c == '\r' || c == '\t';
    }

    static int min(int a,int b){
        return a < b ? a : b;
    }

    static int max(int a,int b){
        return a > b ? a : b;
    }

    static int nextInt() throws Exception{
        char c = (char)in.read();
        while(isSpaceChar(c)){
            c = (char)in.read();
        }

        int sign = 1;
        if(c == '-')
        {
            sign = -1;
            c = (char)in.read();
        }

        int k = 0;
        while(c <= '9' && c >='0'){
            k*=10;
            k+=c-'0';
            c = (char)in.read();
        }
        return k*sign;
    }

    static long nextLong() throws Exception{
        char c = (char)in.read();
        while(isSpaceChar(c)){
            c = (char)in.read();
        }

        int sign = 1;
        if(c == '-')
        {
            sign = -1;
            c = (char)in.read();
        }

        long k = 0;
        while(c <= '9' && c >='0'){
            k*=10;
            k+=c-'0';
            c = (char)in.read();
        }
        return k*sign;
    }

    /* static int nextInt() throws Exception{
        in.nextToken();
        return (int)in.nval;
    }

    static byte nextByte() throws Exception{
        in.nextToken();
        return (byte)in.nval;
    }

    static long nextLong() throws Exception{
        in.nextToken();
        return (long)in.nval;
    }*/
}

/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;

public class Main{

        static int MOD = (int)1e9+7;

        // for dfs
        static int n;
        static int ansi;
        static int[] w;
        static int[] ww;
        static boolean[] isvisited;
        //
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        long m = sc.nextLong();
        long b = sc.nextLong();
        long bananamax = 0;
        for (long i = 0; i <= b*m; i++) {
            long migiue = (m*b - i)/m; // -> migiue is (i, migiue):
            bananamax = Math.max( (i*(i+1)) / 2 * (migiue+1) + migiue*(migiue+1)/2 *(i+1)
                                 , bananamax);
        }
        System.out.println(bananamax);

        sc.close();
    }

        private static long[][] CombinationLong_nCk(long n, long k) {
            n++; k++;
            long[][] ans = new long[(int)n][(int)k];
            for (int i = 0; i < n; i++) {
                ans[i][0] = 1;
            }
            for (int i = 0; i < n-1; i++) {
                for (int j = 0; j < k-1; j++) {
                    if (i < j) {
                        ans[i][j] = 0;
                    }else{
                        ans[i+1][j+1] = ans[i][j] + ans[i][j+1];
                    }
                }
            }
            return ans;
        }

        public static int gcd_int(int a, int b) {
            if (b == 0) {
                return a;
            }else{
                return gcd_int(b, a%b);
            }
        }

        public static long gcd_long(long a, long b) {

            if (a < b) {
                long tmpp = a;
                a = b;
                b = tmpp;
            }
            if (b == 0) {
                return a;
            }else{
                return gcd_long(b, a%b);
            }
        }

        public static int lcm_int(int a, int b) {
            int gcd = gcd_int(a,b);
            return a/gcd*b;
        }

        public static long lcm_long(long a, long b) {
            long gcd = gcd_long(a,b);
            return a/gcd*b;
        }

        public static int ManhattanDist(int x, int y, int xx, int yy) {
            return(Math.abs(xx-x) + Math.abs(yy-y));
        }

            public static void dfs(int placenow) {
                // if went all -> success!
                // if not went all -> fail...

                /*
                dfs
                Go All Place that there is wayto to and not having been yet.

                if island 1 is start point, dfs(1);
                if there is wayto to island 2 and island 3,
                - island 2 changes non-visited -> visited, and dfs(2).
                - island 3 changes non-visited -> visited, and dfs(3).

                */

                isvisited[placenow] = true;
                boolean success = true;
                for (int i = 0; i < n; i++) {
                    if (isvisited[i] == false) { // not go all place
                        success = false;
                        break;
                    }
                }
                if (success) {
                    ansi++;
                    isvisited[placenow] = false;
                    return;
                }

                for (int i = 0; i < n; i++) {
                    if (w[i] == placenow && isvisited[ww[i]] == false ) {
                        dfs(ww[i]);
                    }else if(ww[i] == placenow && isvisited[w[i]] == false){
                        dfs(w[i]);
                    }else{
                        continue;
                    }
                }
                isvisited[placenow] = false;
                return;
            }
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

    static Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

    public static void main(String[] args) {
        int m = input.nextInt();
        int b = input.nextInt();
        long maxRew = 0;
        for (long x = 0; x <= m * b; x++) {
            long y = (m * b - x) / m;
            long rew = (y + 1) * (y + x) * (x + 1) / 2;
            if (rew > maxRew) {
                maxRew = rew;
            }
        }
        System.out.println(maxRew);
    }
}

/*
 * Author: Abhi Sapariya
 */
import java.util.*;
import java.io.*;
import java.math.*;
import java.text.DecimalFormat;

public class Practice{

	static long MOD =(long)Math.pow(10,9)+7;
	static InputReader in;
	static PrintWriter out;

	public static void main(String[] args) {

			in = new InputReader(System.in);
		    out = new PrintWriter(System.out);

		    //CODE
		    long m = in.nextLong();
		    long b = in.nextLong();

		    long maxBananas = 0l;
		    for(long x = 0; x<= (long)Math.floor(m*b); x++){
		    	long y = (long)Math.floor(b*1d - (x*1d)/(m*1d));
		    	long bananas = ((x+1l)*(y+1l)*(x+y))/2l;
		    	maxBananas = Math.max(maxBananas, bananas);
		    }
		    out.println(maxBananas);

		    out.close();

		}

	static class GCDQueries {

		static int mod = (int) (Math.pow(10, 9)) + 7;
		private static int[] st;

		public static int[] constructSegmentTree(int[] arr) {
			int height = (int) Math.ceil(Math.log(arr.length) / Math.log(2));
			int size = 2 * (int) Math.pow(2, height) - 1;
			st = new int[size];
			constructST(arr, 0, arr.length - 1, 0);
			return st;
		}

		public static int constructST(int[] arr, int ss, int se, int si) {
			if (ss == se) {
				st[si] = arr[ss];
				return st[si];
			}
			int mid = ss + (se - ss) / 2;
			st[si] = gcd(constructST(arr, ss, mid, si * 2 + 1),
					constructST(arr, mid + 1, se, si * 2 + 2));
			return st[si];
		}

		private static int gcd(int a, int b) {
			if (a < b) {
				int temp = b;
				b = a;
				a = temp;
			}

			if (b == 0)
				return a;
			return gcd(b, a % b);
		}

		public static int findRangeGcd(int ss, int se, int[] arr) {
			int n = arr.length;

			if (ss < 0 || se > n - 1 || ss > se)
				throw new IllegalArgumentException("Invalid arguments");

			return findGcd(0, n - 1, ss, se, 0);
		}

		public static int findGcd(int ss, int se, int qs, int qe, int si) {
			if (ss > qe || se < qs)
				return 0;

			if (qs <= ss && qe >= se)
				return st[si];

			int mid = ss + (se - ss) / 2;

			return gcd(findGcd(ss, mid, qs, qe, si * 2 + 1),
					findGcd(mid + 1, se, qs, qe, si * 2 + 2));
		}
	}

	static long gcd(long a, long b) {
		if (a == 0 || b == 0)
			return a + b;
		return gcd(b, a % b);
	}

    static long power(long base, long exponent, long modulus){
	    long result = 1L;
	    while (exponent > 0) {
	        if (exponent % 2L == 1L)
	            result = (result * base) % modulus;
	        exponent = exponent >> 1;
	        base = (base * base) % modulus;
	    }
	    return result;
	}

    // This class represents a directed graph using adjacency list
	// representation
	class Graph {
		private int V; // No. of vertices

		// Array  of lists for Adjacency List Representation
		private LinkedList<Integer> adj[];

		// Constructor
		Graph(int v) {
			V = v;
			adj = new LinkedList[v];
			for (int i = 0; i < v; ++i)
				adj[i] = new LinkedList();
		}

		//Function to add an edge into the graph
		void addEdge(int v, int w) {
			adj[v].add(w); // Add w to v's list.
		}

		// A function used by DFS
		void DFSUtil(int v, boolean visited[]) {
			// Mark the current node as visited and print it
			visited[v] = true;
			System.out.print(v + " ");

			// Recur for all the vertices adjacent to this vertex
			Iterator<Integer> i = adj[v].listIterator();
			while (i.hasNext()) {
				int n = i.next();
				if (!visited[n])
					DFSUtil(n, visited);
			}
		}

		// The function to do DFS traversal. It uses recursive DFSUtil()
		void DFS(int v) {
			// Mark all the vertices as not visited(set as
			// false by default in java)
			boolean visited[] = new boolean[V];

			// Call the recursive helper function to print DFS traversal
			DFSUtil(v, visited);
		}
	}

    static HashMap<Long,Long> primeFactors(long n){
        HashMap<Long,Long> ans=new HashMap<Long,Long>();
    	// Print the number of 2s that divide n
        while (n%2L==0L)
        {
            if(ans.containsKey(2L)){
            	ans.put(2L,ans.get(2L)+1L);
            }else{
            	ans.put(2L,1L);
            }
            n /= 2L;
        }

        // n must be odd at this point.  So we can
        // skip one element (Note i = i +2)
        for (long i = 3; i <= Math.sqrt(n); i+= 2L)
        {
            // While i divides n, print i and divide n
            while (n%i == 0)
            {
            	if(ans.containsKey(i)){
                	ans.put(i,ans.get(i)+1L);
                }else{
                	ans.put(i,1L);
                }
                n /= i;
            }
        }

        // This condition is to handle the case whien
        // n is a prime number greater than 2
        if (n > 2)
            ans.put(n,1L);
        return ans;
    }

    //for marking all prime numbers greater than 1 and less than equal to N
    static boolean[] sieveOfEratosthenes(int n) {

		boolean prime[] = new boolean[n];
		// Create a boolean array "prime[0..n]" and initialize
		// all entries it as true. A value in prime[i] will
		// finally be false if i is Not a prime, else true.
		for (int i = 0; i < n; i++)
			prime[i] = true;

		for (int p = 2; p * p <= n; p++) {
			// If prime[p] is not changed, then it is a prime
			if (prime[p] == true) {
				// Update all multiples of p
				for (int i = p * 2; i <= n; i += p)
					prime[i] = false;
			}
		}

		return prime;
	}

    // Binary indexed Tree parameters (arr,arr.length)
    static class BITree {

		int[] tree;

		public BITree(int arr[], int n) {
			tree = new int[n + 1];
			for (int i = 0; i < n; i++) {
				update(i, arr[i]);
			}
		}

		public void update(int x, int val) {
			x++;
			while (x < tree.length) {
				tree[x] += val;
				x = next(x);
			}
		}

		public int sum(int x) {
			x++;
			int ans = 0;
			while (x > 0) {
				ans += tree[x];
				x = parent(x);
			}
			return ans;
		}

		public int parent(int x) {
			return x - (x & -x);
		}

		public int next(int x) {
			return x + (x & -x);
		}

	}

    // Range minimum query Segment Tree parameters - (arr,arr.length)
    static class SegmentTree {

		static int[] segT;

		public SegmentTree(int arr[], int n) {
			int nearPow = (int) (Math.ceil(Math.log(n) / Math.log(2)));
			int len = 2 * ((int) Math.pow(2, nearPow)) - 1;
			segT = new int[len];
			constructTree(arr, 0, n - 1, 0);
		}

		public void constructTree(int arr[], int low, int high, int pos) {
			if (low == high) {
				segT[pos] = arr[low];
				return;
			}

			int mid = (low + high) / 2;
			constructTree(arr, low, mid, 2 * pos + 1);
			constructTree(arr, mid + 1, high, 2 * pos + 2);
			segT[pos] = Math.min(segT[2 * pos + 1], segT[2 * pos + 2]);
		}

		public int rmq(int low, int high, int n) {
			return rmq(0, n - 1, low, high, 0);
		}

		public int rmq(int low, int high, int qlow, int qhigh, int pos) {

			if (qlow <= low && qhigh >= high) {
				return segT[pos];
			}
			if (high < qlow || qhigh < low) {
				return Integer.MAX_VALUE;
			}
			int mid = (low + high) / 2;
			return Math.min(rmq(low, mid, qlow, qhigh, 2 * pos + 1),
					rmq(mid + 1, high, qlow, qhigh, 2 * pos + 2));
		}

	}

    // isPrime
	static boolean isPrime(long n) {
		if(n < 2L) return false;
		if(n == 2L || n == 3L) return true;
		if(n%2L == 0 || n%3L == 0) return false;
		long sqrtN = (long)Math.sqrt(n)+1L;
		for(long i = 6L; i <= sqrtN; i += 6L) {
			if(n%(i-1) == 0 || n%(i+1) == 0) return false;
		}
		return true;
	}

	// Nth fibonacci number%mod in log(n)
	static class fibonacci {
		public static long fib(long n, long mod) {
			long F[][] = new long[][] { { 1, 1 }, { 1, 0 } };
			if (n == 0l)
				return 0l;
			power(F, n - 1, mod);

			return F[0][0] % mod;
		}

		public static void multiply(long F[][], long M[][], long mod) {
			long x = (((F[0][0]) * (M[0][0])) % mod + ((F[0][1]) * (M[1][0]))
					% mod)
					% mod;
			long y = (((F[0][0]) * (M[0][1])) % mod + ((F[0][1]) * (M[1][1]))
					% mod)
					% mod;
			long z = (((F[1][0]) * (M[0][0])) % mod + ((F[1][1]) * (M[1][0]))
					% mod)
					% mod;
			long w = (((F[1][0]) * (M[0][1])) % mod + ((F[1][1]) * (M[1][1]))
					% mod)
					% mod;

			F[0][0] = x;
			F[0][1] = y;
			F[1][0] = z;
			F[1][1] = w;
		}

		/* Optimized version of power() in method 4 */
		public static void power(long F[][], long n, long mod) {
			if (n == 0l || n == 1l)
				return;
			long M[][] = new long[][] { { 1l, 1l }, { 1l, 0l } };

			power(F, n / 2l, mod);
			multiply(F, F, mod);
			if (n % 2l != 0l)
				multiply(F, M, mod);
		}
	}

	//minimum prime factor of all the numbers less than n
    static int minPrime[];
	static void minimumPrime(int n){
		minPrime=new int[n+1];
		minPrime[1]=1;
        for (int i = 2; i * i <= n; ++i) {
            if (minPrime[i] == 0) {         //If i is prime
                for (int j = i * i; j <= n; j += i) {
                    if (minPrime[j] == 0) {
                        minPrime[j] = i;
                    }
                }
            }
        }
        for (int i = 2; i <= n; ++i) {
            if (minPrime[i] == 0) {
                minPrime[i] = i;
            }
        }
	}

	static long modInverse(long A, long M)
	{
		long x=extendedEuclid(A,M)[0];
		return (x%M+M)%M;    //x may be negative
	}

	static long[] extendedEuclid(long A, long B) {
		if(B == 0) {
			long d = A;
			long x = 1;
			long y = 0;
			return new long[]{x,y,d};
		}
		else {
			long arr[]=extendedEuclid(B, A%B);
			long temp = arr[0];
			arr[0] = arr[1];
			arr[1] = temp - (A/B)*arr[1];
			return arr;
		}
	}

	public void printArr(int[] arr){
		for(int i = 0; i < arr.length; i++){
			out.print(arr[i] + " ");
		}
		out.println();
	}

	public void print2DArr(int[][] arr){
		for( int i = 0; i < arr.length; i++){
			for ( int j = 0; j < arr[0].length; j++){
				out.print(arr[i][j] + " ");
			}
			out.println();
		}
	}

	static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        public int[][] nextInt2DArray(int n, int m){
        	int[][] arr = new int[n][m];
        	for (int i = 0; i < n; i++){
        		for(int j = 0; j < m; j++){
        			arr[i][j] = nextInt();
        		}
        	}
        	return arr;
        }

        public long[][] nextLong2DArray(int n, int m){
        	long[][] arr = new long[n][m];
        	for (int i = 0; i < n; i++){
        		for(int j = 0; j < m; j++){
        			arr[i][j] = nextLong();
        		}
        	}
        	return arr;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
	}
}

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Q2CC {

	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		int m=s.nextInt(),b=s.nextInt();
		long x=(long)m*b;
		long y=(long)b;
		Long mx=Long.MIN_VALUE;
		for(long i=x;i>=0;i--){
			double w=(double)i/m;
			w*=(-1.0);
			w+=(double)b;
			long j=(long)Math.floor(w);
			if(mx<(((j*(j+1)*(i+1))/2)+((i*(i+1)*(j+1))/2))){
				mx=(((j*(j+1)*(i+1))/2)+((i*(i+1)*(j+1))/2));
				//System.out.println(i+" "+j);
			}
		}
		System.out.println(mx);
	}

	/*public static Map<Integer,ArrayList<Integer>> row=new HashMap<Integer,ArrayList<Integer>>();
	public static Map<Integer,ArrayList<Integer>> col=new HashMap<Integer,ArrayList<Integer>>();
	public static boolean doable(int num,int a,int b){
		for(int i=0;i<row.get(a).size();i++){
			if(col.get(b).contains(num-row.get(a).get(i))){
				return true;
			}
		}
		return false;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int[][] m=new int[n][n];
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				m[i][j]=s.nextInt();
			}
		}

		for(int i=0;i<n;i++){
			ArrayList<Integer> a=new ArrayList<Integer>();
			ArrayList<Integer> b=new ArrayList<Integer>();
			for(int j=0;j<n;j++){
				a.add(m[i][j]);
				b.add(m[j][i]);
			}
			row.put(i,a);
			col.put(i,b);
		}
		boolean f=true;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(m[i][j]!=1){
					if(!doable(m[i][j],i,j)){
						f=false;
						break;
					}
				}
			}
			if(!f){
				break;
			}
		}
		if(f){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}*/
		/*int t=s.nextInt();
		while(t-->0){
			int n=s.nextInt();
			int[] c=new int[n],w=new int[n];
			for(int i=0;i<n;i++){
				c[i]=s.nextInt();
			}
			for(int i=0;i<n;i++){
				w[i]=s.nextInt();
			}
			//int[] ans=new int[n];
			//HashMap<Integer,Integer> m=new HashMap<Integer,Integer>();
			int mx=-1;
			for(int i=0;i<n;i++){
				int sum=w[i];
				ArrayList<Integer> m=new ArrayList<Integer>();
				m.add(c[i]);
				for(int j=i+1;j<n;j++){
					if(m.contains(c[j])){
						break;
					}
					else{
						sum+=w[j];
						m.add(c[j]);
					}
				}
				if(mx<sum){
					mx=sum;
				}
			}
			System.out.println(mx);
		}*/
	//}

}

import java.util.*;
import java.io.*;
import java.math.*;
public class test
{
    public static void main(String args[])
    {
		int y;
		FastReader scan=new FastReader();
		long m=scan.nextLong();
		int b=scan.nextInt();
		long max=Long.MIN_VALUE;
		for(y=b;y>=0;y--)
		{
			long x=m*(b-y);
			long val=(x+1)*(y*(y+1))/2 + (y+1)*(x*(x+1))/2;
			max=Math.max(max,val);
		}
		System.out.println(max);
	}
}
class FastReader
{
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;

public class CF420 {

	static PrintWriter pw = new PrintWriter(System.out);

	// public static void main(String[] args) throws IOException {
	// Scanner sc = new Scanner(System.in);
	// int n = sc.nextInt();
	// Stack<Integer> st= new Stack<>();
	// int top = 1;
	// boolean ord = false;
	// int count = 0;
	// for(int i=0; i<2*n; i++){
	// String s = sc.next();
	// if(s.equals("add"))
	// {
	// st.push(sc.nextInt());
	// ord = false;
	// }
	// else
	// if(!ord&&st.peek()!=top)
	// {
	// count++;
	// top++;
	// ord = true;
	// }else
	// top++;
	// while(!st.isEmpty()&&st.peek()<=top-1)
	// st.pop();
	// }
	// System.out.println(count);
	// }
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int b = sc.nextInt();
		long max = 0;
		for (int y = 0; y <= b; y++) {
			long x = (b - y) * m;
			long trees = (long) ((1l * x * (x + 1) / 2) * (y + 1) + (1l * y * (y + 1) / 2) * (x + 1));
			max = Math.max(max, trees);

		}
		// for (int i = 0; i <= b * m; i++) {
		// double y = -1*((double) i) / m + b;
		// if ((int) y == y) {
		// long trees = (long) ((1l * i * (i + 1) / 2) * (y + 1) + (1l * y * (y
		// + 1) / 2) * (i + 1));
		// max = Math.max(trees, max);
		// }
		// }
		System.out.println(max);
	}

static class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s) {
		br = new BufferedReader(new InputStreamReader(s));
	}

	public Scanner(String f) throws FileNotFoundException {
		br = new BufferedReader(new FileReader(f));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public int[] nextIntArray(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public int[] nextIntArray1(int n) throws IOException {
		int[] a = new int[n + 1];
		for (int i = 1; i <= n; i++)
			a[i] = nextInt();
		return a;
	}

	public int[] shuffle(int[] a, int n) {
		int[] b = new int[n];
		for (int i = 0; i < n; i++)
			b[i] = a[i];
		Random r = new Random();
		for (int i = 0; i < n; i++) {
			int j = i + r.nextInt(n - i);
			int t = b[i];
			b[i] = b[j];
			b[j] = t;
		}
		return b;
	}

	public int[] nextIntArraySorted(int n) throws IOException {
		int[] a = nextIntArray(n);
		a = shuffle(a, n);
		Arrays.sort(a);
		return a;
	}

	public long[] nextLongArray(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}

	public long[] nextLongArray1(int n) throws IOException {
		long[] a = new long[n + 1];
		for (int i = 1; i <= n; i++)
			a[i] = nextLong();
		return a;
	}

	public long[] newLongArrayC1(int n) throws IOException {
		long[] a = new long[n + 1];
		for (int i = 1; i <= n; i++) {
			a[i] = a[i - 1] + nextLong();
		}
		return a;
	}

	public long[] nextLongArraySorted(int n) throws IOException {
		long[] a = nextLongArray(n);
		Random r = new Random();
		for (int i = 0; i < n; i++) {
			int j = i + r.nextInt(n - i);
			long t = a[i];
			a[i] = a[j];
			a[j] = t;
		}
		Arrays.sort(a);
		return a;
	}
}

}

import java.util.Scanner;

public class bananerama {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long m = sc.nextInt();
		long b = sc.nextInt();
		boolean running = true;
		long cur = 0;
		long max_banana = b;
		long y = b-1;
		long x = 0;
		while(running){
			x = (-1)*(m*(y)) + (m*b);
			cur = ( ((y+1)*x*(x+1)) / 2 ) + ( ((y+1)*y*(x+1)) / 2 );
			if(cur > max_banana){
				max_banana = cur;
			}
			cur = 0;
			y--;
			if(y<0){
				running = false;
			}
		}
		System.out.println(max_banana);
		sc.close();
	}
}

import java.util.Scanner;

/**
 *
 * @author Destarte
 */
public class NewClass {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        int m = input.nextInt();
        int b = input.nextInt();

        int my = b;
        int mx = -b * -m;
        long bananas = 0, maxbananas = 0;

        for (int y = my; y >= 0; y--) {
           long x = -m*(y-b);

           long vx = x * (x+1) / 2;
           long vy = y * (y+1) /2;

           long f = (y+1)* vx + x * vy + vy;

           bananas = f ;
           maxbananas = Math.max(bananas, maxbananas);
        }

        System.out.println(maxbananas);

    }
}

import java.util.*;
public class bananas
{
   static Scanner s; static int m,b; static long max=0;
   public static void main(String[] args)
   {

       s= new Scanner(System.in);
       m=s.nextInt(); b=s.nextInt();
       long[] sols= new long[m*b+1];
       for (int i=0; i<=m*b; i++)
       {
           if (i%m!=0) sols[i]=(long)(b+(double)(-i/m)-0.5);
          else sols[i]=-i/m+b;
        }

       if (b==0) System.out.println(0);
        else
    {
        for (int i=0; i<sols.length; i++)
        {
            if (solve(i,sols[i])>max) max=solve(i,sols[i]);
        }
    }

    System.out.println(max);
    }

    public static long solve(long a, long b)
    {
       return (a+1)*(b+1)*(a+b)/2;
    }
}

import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;

public class M
{
	public static boolean prime[] = new boolean[1000007];

	public static void main(String args[])
	{
		InputReader In = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		long m = In.nextLong();
		long b = In.nextLong();

		long ans = 0;

		for(long i = 0 ; i <= m*b ; i++)
		{
			long k = (m*b-i)/m;

			long temp = (k+1)*i*(i+1)/2 + (i+1)*k*(k+1)/2;

			ans = Math.max(ans , temp);
		}

		w.println(ans);

		w.close();
	}

	public static void sieve()
	{
		Arrays.fill(prime , true);

		prime[0] = false;
		prime[1] = false;

		for(int i = 2 ; i*i < 1000007 ; i++)
		{
			if(prime[i])
			{
				for(int j = i*i ; j < 1000007 ; j+=i)
				{
					prime[j] = false;
				}
			}
		}
	}

	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	static class Node implements Comparable<Node>
	{
		int value;
		int id;

		public Node(int value,int id)
		{
			this.value=value;
			this.id=id;
		}

		public int compareTo(Node node)
		{
			if(value<node.value)
				return 1;

			if(value>node.value)
				return -1;

			if(id<node.id)
				return 1;

			return -1;
		}
	}
}

import java.util.Scanner;

public class B {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int m = sc.nextInt(), b = sc.nextInt();

		long ans = 0;

		for(long y = 0 ; y<=b ;y++){
			long l=0,r=(long)1e7,mid = (l+r)/2;
			while(l<=r){
				if(y+(double)mid/m-b<=0){
					l = mid+1;
				}
				else{
					r = mid-1;
				}
				mid = (l+r)/2;
			}

			ans = Math.max((y+1)*y/2 *(r+1) + (r+1)*r/2 *(y+1), ans);
		}

		System.out.println(ans);
	}
}

import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		while (sc.hasNext()) {
			long m=sc.nextInt();
			long b=sc.nextInt();
			long sum=-1;
			for(int i=0;i<=m*b;i++){
				long x=i;
				long y=(long) (-i*1.0/m+b);
				long res=(x+1)*(((y+1)*y)/2)+(y+1)*(((x+1)*x)/2);
				sum=Math.max(sum,res);
			}
			for(int j=0;j<=b;j++){
				long x=b*m-m*j;
				long y=j;
				long res=(x+1)*(y+1)*y/2+(y+1)*((x+1)*x/2);
				sum=Math.max(sum,res);
			}
			pw.println((long)sum);
			pw.flush();
		}
	}
}
class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	public FastScanner() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer("");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public boolean hasNext() {
		while (!st.hasMoreTokens()) {
			String line = nextLine();
			if (line == null) {
				return false;
			}
			st = new StringTokenizer(line);
		}
		return true;
	}

	public String next() {
		while(!st.hasMoreTokens()){
			st=new StringTokenizer(nextLine());
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public String nextLine() {
		String line = "";
		try {
			line = br.readLine();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return line;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class BananaTree {
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc=new FastReader();
		long m = sc.nextInt();
		long b = sc.nextInt();
		long ans=0;
		for(long i=0;i<=b;i++)
		{
			long x=(b-i)*m;
			ans=Math.max(((x*(x+1)*(i+1))/2)+(((i*(i+1)*(x+1))/2)), ans);
		}
		System.out.println(ans);
	}
}

import java.util.*;

public class Main {

    private static int m;
    private static int b;

    private static long sum(long x, long y) {
        return (x + 1) * (y + 1) * (x + y) / 2;
    }

    private static long y(long x) {
        return (long) (-(double) x / m + b);
    }

    private static long x(long y) {
        return m * (b - y);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        m = in.nextInt();
        b = in.nextInt();

        long max = 0;

        for (int y = 0; y <= b; ++y) {
            long s = sum(x(y), y);
            if (max < s)
                max = s;
        }

        System.out.println(max);
    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long temp=0;
		for(long x=0; x<=a * b; x+=a)
		{
			long y = -x /a + b;
			long ans = (x * (x+1)/2 )*(y+1) + (y*(y+1)/2)*(x+1);
			temp = Math.max(temp,ans);
		}
		System.out.println(temp);
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long temp=0;
		for(long x=0; x<=a * b; x+=a)
		{
			long y = -x /a + b;
			long ans = (x * (x+1)/2 )*(y+1) + (y*(y+1)/2)*(x+1);
			temp = Math.max(temp,ans);
		}
		System.out.println(temp);
	}
}

import java.io.*;
import java.util.*;

public class B420 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int m = in.nextInt();
		int b = in.nextInt();

		long max=0;
		for (int x = 0; x <= b*m; x++) {
			double y1 = -x/(m*1.0) + (double)b;
			long y=(long)y1;
			long sum=((y*(y+1))/2)*(long)(x+1) + (long)(y+1)*(((long)(x+1)*(long)x)/2);
			if(sum>max){
				max=sum;
			}
		}
		System.out.println(max);

	}

}

import java.util.Scanner;

public class OkabeAndBananaTrees {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long m = scan.nextLong(), b = scan.nextLong(), res = 0;
		for(int x = 0; x <= b*m; x+=m) {
			long y = b-x/m;
			long temp = calc(x,y);
			res = Math.max(res, temp);
		}
		System.out.println(res);
	}
	public static long calc(long a, long b) {
		long s = 0, res = 0;
		s = a*(a+1)/2;
		res+=s*(b+1)+(b*(b+1)/2*(a+1));
		return res;
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            long m = in.nextInt();
            long b = in.nextInt();
            long max = 0;
            for (int y = 0; y <= b; y++) {
                long x = (b - y) * m;
                max = Math.max(max, (x + 1) * (y + 1) * (x + y) >>> 1);
            }
            out.println(max);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;

public class main implements Runnable{

    static ArrayList <Integer> adj[];
    static int co=0,f=0;

    static void Check2(int n){
        adj=new ArrayList[n+1];
        for(int i=0;i<=n;i++){
            adj[i]=new ArrayList<>();
        }

    }
    static void add(int i,int j){

        adj[i].add(j);
         }
    public static void main(String[] args)  {
        new Thread(null, new main(), "Check2", 1<<26).start();// to increse stack size in java
    }
    static long mod=(long)(1e9+7);
    public void run() {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        //Scanner in=new Scanner(System.in);

        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long m=in.nextLong();
        long b=in.nextLong();

        long x=m*b;
        long y=b;

        long i=1;
        long j=y;

        long max=0;
        while(j>=0){
        long p=m*(b-j);
            long ans=((p+1)*(j*(j+1)))/2;
            long ans2=((j+1)*((p)*(p+1)))/2;
            max=max(max,ans+ans2);
            j--;
        }

        max=max(max,m*b);
        max=max(max,y);

        w.println(max);

        w.close();
    }
    static  void dfs(int i,int v[],int v2[],int edge){

        if(v[i]==1)return ;
        v[i]=1;
        v2[i]=1;
        Iterator <Integer> it=adj[i].iterator();
        while(it.hasNext()){
            int q=it.next();
            dfs(q,v,v2,edge+1);
        }

    }

    static long power(long x,long y){
        if(y==0)return 1%mod;
        if(y==1)return x%mod;

        long res=1;
        x=x%mod;
        while(y>0){

            if((y%2)!=0){
                res=(res*x)%mod;
            }

            y=y/2;
            x=(x*x)%mod;
        }

        return res;

    }

    static  int gcd(int a,int b){

        if(b==0)return a;
        return gcd(b,a%b);
    }

    static  void sev(int a[],int n){

        for(int i=2;i<=n;i++)a[i]=i;
        for(int i=2;i<=n;i++){

            if(a[i]!=0){
                for(int j=2*i;j<=n;){

                    a[j]=0;
                    j=j+i;
                }
            }

        }

    }

    static class pair implements Comparable<pair> {

        int x,y;
        pair(int c,int d){
            x=c;
            y=d;
        }

        public int compareTo(pair o){

            return (this.x-o.x);   //sort in incrementing order w.r.t to c
        }

    }

    static class node{

        int y;
        int val;

        node(int a,int b){

            y=a;
            val=b;

        }

    }

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

}

import java.util.Scanner;

/**
 * Created by ssaadedin on 7/16/17.
 */
public class OkabeProblemB {

    static class Node {
        int x, y;

        public Node(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        @Override
        public String toString() {
            return "Node{" +
                    "x=" + x +
                    ", y=" + y +
                    '}';
        }
    }

    private static Scanner scanner;
    private  static int m, b;

    public static void main(String[] args) {
        scanner = new Scanner(System.in);

        m = scanner.nextInt();
        b = scanner.nextInt();

        long y = Integer.MAX_VALUE;
        long maxSum = 0;
        long testSum = 0;
        long x = 0;

        while (true) {
            y = findY(x);

            if (y < 0 ) {
                break;
            }

            testSum =( (x * (x + 1) / 2 ) * (y + 1)) + ( (y * (y + 1) / 2 ) * (x +1));

            if (testSum > maxSum) {
                maxSum = testSum;

            }
            x++;

        }

        System.out.println(maxSum);

    }

    public static int findY(double x){
        return (int)Math.floor( (x/ -m) + b);
    }

    public static int findX(int y) {
        return  (b - y) *m;
    }

    public static boolean isInLine(int x, int y) {
        return y + (x / m) - b == 0;

    }
}

import java.util.Scanner;

public class P821B
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int m = scan.nextInt();
		int b = scan.nextInt();
		long max = 0;
		int y = b;
		int rem = 0;
		int x = 0;
		while (y >= 0)
		{
			max = Math.max(max, sum(x)*(y+1) + sum(y)*(x+1));
			if (rem == 0)
			{
				y--;
				rem = m;
			}
			rem--;
			x++;
		}

		System.out.println(max);
	}

	private static long sum(long n)
	{
		return n*(n+1)/2;
	}
}

import java.util.Scanner;

public class Code1 {

    static long m, b;

    static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        long x, y;
        m = in.nextInt();
        b = in.nextInt();

        long x0 = b * m;
        long y0 = b;
        long maxSum = 0;
        long sum;

        if (x0 <= y0) {
            for (long i = 0; i <= x0; i++) {
                y = -i / m + b;
                sum = trees(i, y);
                if (sum > maxSum) {
                    maxSum = sum;
                }
            }
        } else {
            for (long i = 0; i <= y0; i++) {
                x = (b - i) * m;
                sum = trees(x, i);
                if (sum > maxSum) {
                    maxSum = sum;
                }
            }

        }
        System.out.print(maxSum);
    }

    static long sumX, sumY;

    public static long trees(long x, long y) {
        sumX = x * (x + 1) / 2;
        sumX = sumX * (y + 1);
        sumY = y * (y + 1) / 2;
        sumY = sumY * (x + 1);
        return sumX + sumY;
    }

}

/**
 * DA-IICT
 * Author : Savaliya Sagar
 */
import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class B821 {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int m;
	int b;
	void solve() {
		m = ni();
		b = ni();
		long ans = 0;
		for(int i=0;i<=m*b;i++){
			ans = max(ans,f(i));
		}
		out.println(ans);
	}

	double ts(double left,double right,double absoluteprecision){
		while(true){
			//left and right are the current bounds; the minimum is between them
			if(right-left<absoluteprecision)
	    	   return (left + right)/2;
	       double leftThird = left + (right - left)/3;
	       double rightThird = right - (right - left)/3;

	        if(f(leftThird) < f(rightThird))
	            left = leftThird;
	        else
	            right = rightThird;
	        }
	}

	long f(double x){
		double y = -x/m + b + 0.000001;
		if(y<0)
			return 0;
		tr(x,y);
		long p = (long)x;
		long q = (long)y;
		long ans = ((p*(p+1))/2)*(q+1) + ((q*(q+1))/2)*(p+1);
		return ans;
	}

	long f2(double y){
		double x = m*(b-y);
		if(y<0)
			return 0;
		long p = (long)x;
		long q = (long)y;
		long ans = ((p*(p+1))/2)*(q+1) + ((q*(q+1))/2)*(p+1);
		return ans;
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new B821().run();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b !=
										// ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

import java.util.*;
import java.io.*;

public class OkabeAndBananaTrees {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] input = in.readLine().split(" ");
    int M = Integer.parseInt(input[0]);
    int B = Integer.parseInt(input[1]);
    long max = 0;
    int x = 0;
    for(int y = B; y >= 0; y--) {
      max = Math.max(max, (x+1)*(y+1)*(x+y)/2);
      x += M;
    }
    System.out.println(max);
  }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Codef {

    public static void main(String[] args) {
     FastReader read = new FastReader () ;
     int m = read.nextInt();
     int b = read.nextInt();

     long ans = 0 , max  = 0 ;
    long x = 0 ;
     long y  = (-x / m) +b ;
     while(y >= 0 ){

         ans = (x+1) * (y+1) * (x+y) / 2;
         max = Math.max(max, ans);
         x++;
         y= (-x / m ) + b  ;
     }
        System.out.println(max);

}}
class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }}

import java.io.*;
import java.util.*;

/*
Solution Sketch:
*/

public class banana {

	static final boolean stdin = true;
	static final String filename = "";
	static FastScanner br;
	static PrintWriter pw;

	public static void main(String[] args) throws IOException {

		if (stdin) {
			br = new FastScanner();
			pw = new PrintWriter(new OutputStreamWriter(System.out));
		}

		else {
			br = new FastScanner(filename + ".in");
			pw = new PrintWriter(new FileWriter(filename + ".out"));
		}

		X solver = new X();
		solver.solve(br, pw);
	}

	static class X {
		static int m,b;
		public void solve(FastScanner br, PrintWriter pw) throws IOException {
			m = br.nextInt();
			b = br.nextInt();
			int mx = 0;
			for(int x = 0; x <= m*b; x+= m) {
				int y = gy(x);
//				pw.println(x + " " + y + " " + pre[x][y]);
				mx = Math.max(mx, solve(x,y));
			}
			pw.println(mx);
			pw.close();
		}
		public static int gy(int x) {
			return (-1 * (x/m))+b;
		}
		public static int arith(int c) {
			return (c * (c+1))/2;
		}
		public static int solve(int x, int y) {
			return (x+1) * arith(y) + ((y+1) * (arith(x)));
		}

	}

	//fastscanner class
	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

}

import java.util.*;

import java.io.*;
import java.math.*;
 public class Q1 {

	static ArrayList<Integer> adj[],adj2[];
	static int color[],cc;
	static long mod=1000000007;
	static TreeSet<Integer> ts;
	static boolean b[],visited[],possible,ans1,ans2;
	static Stack<Integer> s;
	static int totalnodes,colored,minc;
	static int c[],a[],n,parent[],ans[],size[];
	static long sum[];
	static HashMap<Integer,Integer> hm;
	public static void main(String[] args) throws IOException {

		//Scanner sc=new Scanner(System.in);
		in=new InputReader(System.in);
		out=new PrintWriter(System.out);
		int m=in.nextInt();
		int b=in.nextInt();
		int y=b;
		int x=(b*m);
		/*double midx=(double)(x)/2;double midy=(double)(y)/2;
		if(midx==Math.floor(midx) && midy==Math.floor(midy))
		{
			long ans=(long)(midx+1)*((long)(midy*(midy+1))/2);
			 ans+=(long)(midy+1)*((long)(midx*(midx+1))/2);
			out.println(ans);
		}
		else
		{

				int ans1=(int)((int)(midx/m)+1)*m;
				int ans2=-(ans1/m)+b;
				long ans=(long)(ans1+1)*((long)(ans2*(ans2+1))/2);
				 ans+=(long)(ans2+1)*((long)(ans1*(ans1+1))/2);
				out.println(ans);

		}
		*/
		long max=0;
		for(int i=y;i>=0;i--)
		{
			int x1=(i-b)*(-1*m);
			long ans=(long)(x1+1)*((long)(i*(i+1))/2);
			 ans+=(long)(i+1)*((long)(x1*(x1+1))/2);
			max=Math.max(max,ans);
		}
		out.println(max);
		out.close();
		}
	static int check(int m)
	{
		int c=0;
		for(int i=0;i<n-1;i++)
		{
			int l=i;
			int r=n-1;
			while(l<r)
			{
				int mid=(l+r)/2;

				if(a[i]+m+1>a[mid])
					l=mid+1;
				else
					r=mid;
			}
		//debug(" l****** "+l);
			if(!(a[l]-a[i]<=m))
			while(a[l]==a[l-1])
				l--;

		//	debug((l-1-(i)));
			if(l==n-1 && !(a[l]-a[i]>m) )
				c=c+l-i;
			else
			c=c+(l-1-(i));
		}

		return c;
	}
	static InputReader in;
	static PrintWriter out;
 	static void dfs(int i)
	{
 		 size[i]=1;int badabeta=0;
 		 for(int j=0;j<adj[i].size();j++)
 		 {
 			 int son=adj[i].get(j);
 			 dfs(son);
 			 size[i]+=size[son];

 			 if(size[son]>size[badabeta])
 				 badabeta=son;
 		 }
 		 if(size[badabeta]*2>size[i])
 		 {
 			 int dada = ans[badabeta];
 			 while((size[i]-size[dada])*2>size[i])
 				 dada=parent[dada];
 			 ans[i]=dada;
 		 }

	}
	/*public static void seive(long n){
		b = new boolean[(int) (n+1)];
	Arrays.fill(b, true);

		for(int i = 2;i*i<=n;i++){
			if(b[i]){
				sum[i]=count[i];
			//	System.out.println(sum[i]+" wf");
				for(int p = 2*i;p<=n;p+=i){
					b[p] = false;
					sum[i]+=count[p];
					//System.out.println(sum[i]);
				}
			}

		}
	}*/
	static class Pair implements Comparable<Pair> {
		int i;
		int j;
		//int index;
		public Pair(){

		}
		public Pair(int u, int v) {
			this.i = u;
			this.j= v;

		}
		public int compareTo(Pair other) {

				return this.j-other.j;
		}

		/*public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}*/
	}
	static class Node2{
		Node2 left = null;
		Node2 right = null;
		Node2 parent = null;
		int data;
	}

	//binaryStree
	static class BinarySearchTree{
		Node2 root = null;
		int height = 0;
		int max = 0;
		int cnt = 1;
		ArrayList<Integer> parent = new ArrayList<>();
		HashMap<Integer, Integer> hm = new HashMap<>();
		public void insert(int x){
			Node2 n = new Node2();
			n.data = x;
			if(root==null){
				root = n;
			}
			else{
				Node2 temp = root,temp2 = null;
				while(temp!=null){
					temp2 = temp;
					if(x>temp.data) temp = temp.right;
					else temp = temp.left;
				}
				if(x>temp2.data) temp2.right = n;
				else temp2.left = n;
				n.parent = temp2;
				parent.add(temp2.data);
			}
		}
		public Node2 getSomething(int x, int y, Node2 n){
			if(n.data==x || n.data==y) return n;
			else if(n.data>x && n.data<y) return n;
			else if(n.data<x && n.data<y) return getSomething(x,y,n.right);
			else return getSomething(x,y,n.left);
		}
		public Node2 search(int x,Node2 n){
			if(x==n.data){
				max = Math.max(max, n.data);
				return n;
			}
			if(x>n.data){
				max = Math.max(max, n.data);
				return search(x,n.right);
			}
			else{
				max = Math.max(max, n.data);
				return search(x,n.left);
			}
		}
		public int getHeight(Node2 n){
			if(n==null) return 0;
			height = 1+ Math.max(getHeight(n.left), getHeight(n.right));
			return height;
		}
	}
public static void debug(Object... o) {
	System.out.println(Arrays.deepToString(o));
}

public static String rev(String s)
{
	StringBuilder sb=new StringBuilder(s);
	sb.reverse();
	return sb.toString();
}

static long lcm(long a, long b)
{
    return a * (b / gcd(a, b));
}

static long gcd(long a, long b)
{
    while (b > 0)
    {
        long temp = b;
        b = a % b; // % is remainder
        a = temp;
    }
    return a;
}

public static long max(long x, long y, long z){
		if(x>=y && x>=z) return x;
		if(y>=x && y>=z) return y;
		return z;
	}
	static int[] sieve(int n,int[] arr)
	{
	for(int i=2;i*i<=n;i++)
	{
		if(arr[i]==0)
		{
			for(int j=i*2;j<=n;j+=i)
				arr[j]=1;
		}
	}
	return arr;
	}

static class InputReader {

private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;

public InputReader(InputStream stream) {
  this.stream = stream;
}

public int snext() {
  if (snumChars == -1)
    throw new InputMismatchException();
  if (curChar >= snumChars) {
    curChar = 0;
    try {
      snumChars = stream.read(buf);
    } catch (IOException e) {
      throw new InputMismatchException();
    }
    if (snumChars <= 0)
      return -1;
  }
  return buf[curChar++];
}

public int nextInt() {
  int c = snext();
  while (isSpaceChar(c)) {
    c = snext();
  }
  int sgn = 1;
  if (c == '-') {
    sgn = -1;
    c = snext();
  }
  int res = 0;
  do {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  } while (!isSpaceChar(c));
  return res * sgn;
}

public long nextLong() {
  int c = snext();
  while (isSpaceChar(c)) {
    c = snext();
  }
  int sgn = 1;
  if (c == '-') {
    sgn = -1;
    c = snext();
  }
  long res = 0;
  do {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  } while (!isSpaceChar(c));
  return res * sgn;
}

public int[] nextIntArray(int n) {
	 return nextIntArray(n, 0);
	    }

public int[] nextIntArray(int n, int off) {
	 int[] arr = new int[n + off];
	   for (int i = 0; i < n; i++) {
	    arr[i + off] = nextInt();
	    }
	    return arr;
	    }

public long[] nextLongArray(int n) {
return nextLongArray(n, 0);
	    }

	public long[] nextLongArray(int n, int off) {
	 long[] arr = new long[n + off];
	 for (int i = 0; i < n; i++) {
		  arr[i + off] = nextLong();
		 }
 return arr;
	}

public String readString() {
  int c = snext();
  while (isSpaceChar(c)) {
    c = snext();
  }
  StringBuilder res = new StringBuilder();
  do {
    res.appendCodePoint(c);
    c = snext();
  } while (!isSpaceChar(c));
  return res.toString();
}

public String nextLine() {
  int c = snext();
  while (isSpaceChar(c))
    c = snext();
  StringBuilder res = new StringBuilder();
  do {
    res.appendCodePoint(c);
    c = snext();
  } while (!isEndOfLine(c));
  return res.toString();
}

public boolean isSpaceChar(int c) {
  if (filter != null)
    return filter.isSpaceChar(c);
  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}

private boolean isEndOfLine(int c) {
  return c == '\n' || c == '\r' || c == -1;
}

public interface SpaceCharFilter {
  public boolean isSpaceChar(int ch);
}
}

}

/*

        HARSH KHATRI
        DA-IICT

                      */

import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

public class CF821B {

    static FasterScanner in = new FasterScanner();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {

        long x, y, m = in.nextLong(), b = in.nextLong();

        y = (b>>1);
        x = b-y; x *= m;

        long ans = (x+y)*(x+1)*(y+1);
        if(y<b) ans = Math.max(ans, (x+y+1-m)*(x-m+1)*(y+2));
        if(y>0) ans = Math.max(ans, (x+y+m-1)*(x+m+1)*(y));
        ans >>= 1;

        out.println(ans);
        out.close();
    }
}

class Pair implements Comparator<Pair> {

    int x;
    int y;

    Pair() {}

    Pair(int a, int b) {
        x = a;
        y = b;
    }

    @Override
    public int compare(Pair p, Pair q) {
        return (p.y-q.y);
    }

    @Override
    public boolean equals(Object object) {

        if(object!=null && object instanceof Pair) {
            return (this.x==((Pair)object).x && this.y==((Pair)object).y);
        }

        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}

class FasterScanner {
    private byte[] buf = new byte[1024];
    private int curChar;
    private int snumChars;

    public int read() {
      if (snumChars == -1)
    throw new InputMismatchException();
      if (curChar >= snumChars) {
    curChar = 0;
    try {
      snumChars = System.in.read(buf);
    } catch (IOException e) {
      throw new InputMismatchException();
    }
    if (snumChars <= 0)
      return -1;
      }
      return buf[curChar++];
    }

    public double nextDouble() {
      return Double.parseDouble(this.nextString());
    }

    public String nextLine() {
      int c = read();
      while (isSpaceChar(c))
    c = read();
      StringBuilder res = new StringBuilder();
      do {
    res.appendCodePoint(c);
    c = read();
      } while (!isEndOfLine(c));
      return res.toString();
    }

    public String nextString() {
      int c = read();
      while (isSpaceChar(c))
    c = read();
      StringBuilder res = new StringBuilder();
      do {
    res.appendCodePoint(c);
    c = read();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public long nextLong() {
      int c = read();
      while (isSpaceChar(c))
    c = read();
      int sgn = 1;
      if (c == '-') {
    sgn = -1;
    c = read();
      }
      long res = 0;
      do {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int nextInt() {
      int c = read();
      while (isSpaceChar(c))
    c = read();
      int sgn = 1;
      if (c == '-') {
    sgn = -1;
    c = read();
      }
      int res = 0;
      do {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int[] nextIntArray(int n) {
      int[] arr = new int[n];
      for (int i = 0; i < n; i++) {
    arr[i] = nextInt();
      }
      return arr;
    }

    public long[] nextLongArray(int n) {
      long[] arr = new long[n];
      for (int i = 0; i < n; i++) {
    arr[i] = nextLong();
      }
      return arr;
    }

    private boolean isSpaceChar(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
      return c == '\n' || c == '\r' || c == -1;
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

public final class round_420_b
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static int maxn=(int)(1e6+6);

	static long get(long xx)
	{
		return (xx*(xx+1))/2;
	}

    public static void main(String args[]) throws Exception
    {
		double m=sc.nextDouble(),b=sc.nextDouble();long res=0,add=0;

		double min=Double.MAX_VALUE;

		for(double i=0;i<maxn;i++)
		{
			double curr=(-i/m)+b;add=add+(long)i;

			min=Math.min(min,curr);

			long xx=(long)Math.floor(min);

			if(xx>=0)
			{
				long val1=(get(xx)*(long)(i+1)),val2=(add*(xx+1));

				res=Math.max(res,val1+val2);
			}
		}

		out.println(res);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;

public class main implements Runnable{

    static ArrayList <Integer> adj[];
    static int co=0,f=0;

    static void Check2(int n){
        adj=new ArrayList[n+1];
        for(int i=0;i<=n;i++){
            adj[i]=new ArrayList<>();
        }

    }
    static void add(int i,int j){

        adj[i].add(j);
         }
    public static void main(String[] args)  {
        new Thread(null, new main(), "Check2", 1<<26).start();// to increse stack size in java
    }
    static long mod=(long)(1e9+7);
    public void run() {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        //Scanner in=new Scanner(System.in);

        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long m=in.nextLong();
        long b=in.nextLong();

        long x=m*b;
        long y=b;

        long i=1;
        long j=y-1;

        long max=0;
        while(j>0){
        long p=m*(b-j);
            long ans=((p+1)*(j*(j+1)))/2;
            long ans2=((j+1)*((p)*(p+1)))/2;
            max=max(max,ans+ans2);
            j--;
        }

        max=max(max,m*b);
        max=max(max,y);

        w.println(max);

        w.close();
    }
    static  void dfs(int i,int v[],int v2[],int edge){

        if(v[i]==1)return ;
        v[i]=1;
        v2[i]=1;
        Iterator <Integer> it=adj[i].iterator();
        while(it.hasNext()){
            int q=it.next();
            dfs(q,v,v2,edge+1);
        }

    }

    static long power(long x,long y){
        if(y==0)return 1%mod;
        if(y==1)return x%mod;

        long res=1;
        x=x%mod;
        while(y>0){

            if((y%2)!=0){
                res=(res*x)%mod;
            }

            y=y/2;
            x=(x*x)%mod;
        }

        return res;

    }

    static  int gcd(int a,int b){

        if(b==0)return a;
        return gcd(b,a%b);
    }

    static  void sev(int a[],int n){

        for(int i=2;i<=n;i++)a[i]=i;
        for(int i=2;i<=n;i++){

            if(a[i]!=0){
                for(int j=2*i;j<=n;){

                    a[j]=0;
                    j=j+i;
                }
            }

        }

    }

    static class pair implements Comparable<pair> {

        int x,y;
        pair(int c,int d){
            x=c;
            y=d;
        }

        public int compareTo(pair o){

            return (this.x-o.x);   //sort in incrementing order w.r.t to c
        }

    }

    static class node{

        int y;
        int val;

        node(int a,int b){

            y=a;
            val=b;

        }

    }

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

}

import java.util.Scanner;

public class Code1 {

   static int x0, y0;
   static int x, y;
   static int m, b;

    static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        m = in.nextInt();
        b = in.nextInt();

        int x0 = getX(0);
        int y0 = b;
        int maxSum = 0;
        int opX = 0;
        int opY = 0;

        if(x0<=y0){
            int mX = x0/2 ;
            for(int i=Math.max(0, mX- mX/2); i<=Math.min(x0, x0 + mX/2);i++){
                x = i;
                double yy =  getY(x);
                if(Math.ceil(yy) == Math.floor(yy)){
                    y = (int)yy;
                }else {
                    continue;
                }

                int sum = trees(x, y);
                if(sum > maxSum){
                    maxSum = sum;
                }
            }
        }else{
            int mY = y0/2;
            for(int i=Math.max(0, mY-mY/2); i<=Math.min(y0, mY+mY/2);i++){
                y = i;
                x = getX(y);
                int sum = trees(x, y);
                if(sum > maxSum){
                    maxSum = sum;
                }
            }

        }
        System.out.println(maxSum);
    }

    public static int getX(int y){
        return (b - y)*m;
    }

    public static double getY(int x){
        return -x/(double)m + b;
    }

    public static int trees (int x, int y){
        int sum = 0;
        for(int i=0; i<=x; i++){
            for (int j=0; j<=y; j++){
                sum+=i+j;
            }
        }
        return sum;
    }

}

//package com.daimens.algorithm.codeforce.round23;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		int m = in.nextInt();
		int b = in.nextInt();
		long max = 0;
		for (int x = 0; x <= m * b; ++x){
			int y = b - (int)Math.ceil(x / (m * 1.0));
			max = Math.max(max, sum(x,y));
		}
//		int x = m * b / 2;
//		max = Math.max(max, sum(x,b - (int)Math.ceil(x / (m * 1.0))));
//		max = Math.max(max, sum(x + 1, b - (int)Math.ceil((x + 1) / (m * 1.0))));
//		max = Math.max(max, sum(x - 1, b - (int)Math.ceil((x - 1) / (m * 1.0))));
		System.out.println(max);
	}

	public static long sum(int x, int y){
		long sum = 0;
		sum += (x + 1) * (y * (y + 1)) / 2;
		sum += y * (x * (x + 1)) / 2;
		sum += x * (x + 1) / 2;
		return sum;
	}

	static class Scanner {

		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
			getLine();
		}

		private void getLine() throws IOException {
			while (tok == null || !tok.hasMoreTokens()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok.hasMoreTokens();
		}

		public String next() throws IOException {
			if (hasNext()) {
				return tok.nextToken();
			} else {
				getLine();
				return tok.nextToken();
			}
		}

		public int nextInt() throws IOException {
			if (hasNext()) {
				return Integer.parseInt(tok.nextToken());
			} else {
				getLine();
				return Integer.parseInt(tok.nextToken());
			}
		}

		public long nextLong() throws IOException {
			if (hasNext()) {
				return Long.parseLong(tok.nextToken());
			} else {
				getLine();
				return Long.parseLong(tok.nextToken());
			}
		}

		public double nextDouble() throws IOException {
			if (hasNext()) {
				return Double.parseDouble(tok.nextToken());
			} else {
				getLine();
				return Double.parseDouble(tok.nextToken());
			}
		}
	}
}

import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
	static BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
public static void main(String args[]) throws NumberFormatException, IOException {
	//next<datatype>() for input of a type
	//next<datatyoe>array() for array input of a type
	int mb[] = nextIntarray();
	int m =mb[0],b=mb[1];
//	int b = nextInt();
	int x = m*b;
	long lsum=0,max=0;
	for(int i=0;i<x;i++){
		int y = (int)(-i/(double)m+b);
		lsum=((long)y*(y+1))/2*(i+1)+ ((long)i*(i+1))/2*(y+1);
//		System.out.println(lsum);
		max=Math.max(lsum,max);
	}
	System.out.println(max);
//############################################################################################################
    //Collections.reverse(n);

//	HashMap<Integer, Integer> hmap = new HashMap<Integer, Integer>();
//	for(Map.Entry pair: hmap.entrySet()){
//
//	}

////		it = hmap.entrySet().iterator();
////		while (it.hasNext()) {
////	        Map.Entry pair = (Map.Entry)it.next();
//////		        System.out.println(pair.getKey() + " = " + pair.getValue());
////	        ArrayList<Object> x=(ArrayList<Object>) pair.getValue();
////	        for(int i=0;i<x.size();i++){
//////	        	System.out.println(arr[(int)x.get(i)]);
////	        	if(arr[(int)x.get(i)]!=1){
//////	        		System.out.println(x.get(i)+"xxx");
////	        		int idx = (int)pair.getKey();
////	        		ans[idx]=(int)x.get(i);
////		        	arr[(int)x.get(i)]=1;
////		        	break;
////	        	}
////	        }
//////	        it.remove(); // avoids a ConcurrentModificationException
////	    }

	}

class Mycompare implements Comparator<Integer>{
	public int compare(Integer x, Integer y){
		return -1;
	}
}

public static ArrayList<Integer> findPerm(final String A, int B) {
    int cntI=0,cntD=0;
    int ni = B,nd=1;
    ArrayList<Integer> ans = new ArrayList<Integer>();
    for(int i=0;i<B-1;i++){
        if(A.charAt(i)=='D'){
            ans.add(ni);
            System.out.println(ni);
            ni=ni-1;
        }
        else{
            ans.add(nd);
            System.out.println(nd);
            nd+=1;
        }
    }
    ans.add(nd);

     for(int i=0;i<ans.size();i++){
         System.out.println("a"+ans.get(i));
     }
    return ans;
}

private static double[] nextDoublearray() throws IOException {
	String s[]=bf.readLine().split(" ");
	double arr[]=new double[s.length];
	for(int i=0;i<s.length;i++){
		arr[i]=Double.parseDouble(s[i]);
	}
	return arr;
}

private static double nextDouble() throws NumberFormatException, IOException {
	return Double.parseDouble(bf.readLine());
}

private static long GCD(long a, long b) {
	   if (b==0) return a;
	   return GCD(b,a%b);
}

private static long[] nextLongarray() throws IOException {
	String s[]=bf.readLine().split(" ");
	long arr[]=new long[s.length];
	for(int i=0;i<s.length;i++){
		arr[i]=Long.parseLong(s[i]);
	}
	return arr;
	}

private static long nextLong() throws NumberFormatException, IOException {
	return Long.parseLong(bf.readLine());
	}

private static int[] nextIntarray() throws IOException {
	String s[]=bf.readLine().split(" ");
	int arr[]=new int[s.length];
	for(int i=0;i<s.length;i++){
		arr[i]=Integer.parseInt(s[i]);
	}
	return arr;
}

private static int nextInt() throws NumberFormatException, IOException {
	return Integer.parseInt(bf.readLine());
}
private static boolean isPalindrome(String s) {

	  int n = s.length();
	  for (int i=0;i<(n / 2) + 1;++i) {
	     if (s.charAt(i) != s.charAt(n - i - 1)) {
	         return false;
	     }
	  }

	  return true;
	}
private static int factorial(int num)
{
    if (num == 0 || num == 1)
    {
        return 1;
    }
    else
    {
        return(num * factorial(num - 1));
    }
}
private static long power(long b,long e){
if (e == 0) return 1;
	    if (e%2==0) return power(b*b, e/2);
	    /* e is odd */ return b * power(b, e-1);
}
private static long lcm(long a, long b)
{
    return a * (b / GCD(a, b));
}

private static boolean isPrimeNumber(long number){

        for(long i=2; i<=number/2; i++){
            if(number % i == 0){
                return false;
            }
        }
        return true;
    }

/*COMBINATION CODE
	void combinationUtil(int arr[], int n, int r, int index, int data[], int i)
{
    // Current cobination is ready, print it
    if (index == r)
    {
        for (int j=0; j<r; j++)
            printf("%d ",data[j]);
        printf("\n");
        return;
    }

    // When no more elements are there to put in data[]
    if (i >= n)
        return;

    // current is included, put next at next location
    data[index] = arr[i];
    combinationUtil(arr, n, r, index+1, data, i+1);

    // current is excluded, replace it with next (Note that
    // i+1 is passed, but index is not changed)
    combinationUtil(arr, n, r, index, data, i+1);

	}
		 */

//PERMUTATION CODE
/*

		 void permute(char *a, int l, int r)
	{
   int i;
   if (l == r)
     printf("%s\n", a);
   else
   {
       for (i = l; i <= r; i++)
       {
          swap((a+l), (a+i));
          permute(a, l+1, r);
          swap((a+l), (a+i)); //backtrack
       }
   }
	}*/

}

import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		while (sc.hasNext()) {
			long m=sc.nextInt();
			long b=sc.nextInt();
			long sum=-1;
			for(int i=0;i<=m*b;i++){
				long x=i;
				long y=(long) Math.floor(-x/m+b);
				long res=(x+1)*(y+1)*y/2+(y+1)*((x+1)*x/2);
				sum=Math.max(sum,res);
			}
			for(int j=0;j<=b;j++){
				long x=b*m-m*j;
				long y=j;
				long res=(x+1)*(y+1)*y/2+(y+1)*((x+1)*x/2);

			}
			pw.println((long)sum);
			pw.flush();
		}
	}
}
class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	public FastScanner() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer("");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public boolean hasNext() {
		while (!st.hasMoreTokens()) {
			String line = nextLine();
			if (line == null) {
				return false;
			}
			st = new StringTokenizer(line);
		}
		return true;
	}

	public String next() {
		while(!st.hasMoreTokens()){
			st=new StringTokenizer(nextLine());
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public String nextLine() {
		String line = "";
		try {
			line = br.readLine();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return line;
	}
}

import java.io.*;
import java.util.*;
public class Problem420B
{
   boolean DEBUG=false;
   BufferedReader br;
   PrintWriter pw;
   public static void main(String[] args) throws Exception
   {
      new Problem420B();
   }
   public Problem420B() throws Exception{
      br = new BufferedReader(new InputStreamReader(System.in));
      pw = new PrintWriter(System.out);
      main();
      pw.close();
   }
   public void main() throws Exception{
      StringTokenizer st;
      st = getst(br);
      int m = nextInt(st);
      int b = nextInt(st);
      binarySearch(b,m);
      // pw.println();
   }
   public void binarySearch(int b, int m)
   {
      //y=-x/m+b
      long lowestPossible=0;
      long highestPossible = b;
      while(lowestPossible<highestPossible)
      {
         long cury=(lowestPossible+highestPossible)/2;
         long x = (b-cury)*m;
         long calc = calc(x,cury);
         long xOneUp=b-(cury+1)*m;
         long calcOneUp = calc(xOneUp,cury+1);
         if(calcOneUp>calc)
            lowestPossible=cury+1;
         else
            highestPossible=cury;
      }
      long expectedY = (lowestPossible+highestPossible)/2;
      long finalCalc=0;
      for(int k=-10; k<=10; k++)
      {
         long cury = expectedY+k;
         long curx = (b-cury)*m;
         if(cury>=0 && curx>=0)
            finalCalc = Math.max(finalCalc,calc(curx,cury));
      }
      pw.println(finalCalc);
   }
   public long calc(long x, long y)
   {
      y++;
      return (y*(x+1)*x)/2+(y*(y-1)*(x+1))/2;
   }
   public static StringTokenizer getst(BufferedReader br) throws Exception{
      return new StringTokenizer(br.readLine(), " ");
   }
   public static int nextInt(StringTokenizer st) throws Exception{
      return Integer.parseInt(st.nextToken());
   }
   public static long nextLong(StringTokenizer st) throws Exception{
      return Long.parseLong(st.nextToken());
   }
   public static String next(StringTokenizer st) throws Exception{
      return st.nextToken();
   }
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class main1 {
	public static void main (String[] args) {
	    Scanner sc=new Scanner(System.in);
	  Hashtable<Integer,Hashtable<Integer,Integer>> h1=new Hashtable();

	    int m=sc.nextInt();
        int b=sc.nextInt();
        int y=b;
        int x=(b)*m;
        int max=0;
        int arr[]=new int[y+1];
        for(int i=1;i<=x;i++){
        	arr[0]=arr[0]+i;

        }
        if(arr[0]>max) max=arr[0];
        int x2=x;
        for(int i=1;i<=y;i++){
        	int x1=(b-i)*m;
        	arr[i]=arr[i-1]+i*(x1+1);
        	int n=x1;

        	arr[i]=arr[i]+(n*(2+(x1-1)))/2;
        	int sum=((x2-x1)*(2*(x1+1)+(x2-x1-1)))/2;

        	arr[i]=arr[i]-i*sum;
        	int n1=i-1;
        	arr[i]=arr[i]-(x2-x1)*(n1*(2+(n1-1)))/2;

        	if(max<arr[i]) max=arr[i];
        	x2=x1;
        }

        System.out.println(max);

        //System.out.println(max);

	}}

import java.util.*;
public class Main {

    public static void main(String args[])
    {
        Scanner in = new Scanner(System.in);

        int m = in.nextInt();
        int b = in.nextInt();

        int maxv = 0;
        int ans = 0;
        int x = 0;
        while (x <= m * b) {
            if (x % m != 0) {x++; continue;}
            int y = b - x / m;
            ans = (1 + x) * (1 + y) * (x + y) / 2;
            maxv = ans > maxv ? ans : maxv;
            x++;
        }
        System.out.println(maxv);
    }
}

import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
public class code
{
    public static int sum(int x, int y)
    {
        return (x+1)*(y+1)*(x+y)/2;
    }
    public static void main(String[] args) throws IOException
    {
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       StringTokenizer st = new StringTokenizer(br.readLine());
       int m = Integer.parseInt(st.nextToken());
       int b = Integer.parseInt(st.nextToken());
       int max = 0;
       for(int i = 0; i<m*b+1; i++)
       {
          int x= i;
          int y = (int) (-1.0*x/((double) m)+b);
          x = m*b-m*y;
          if(sum(x,y)>max)
          {
              //System.out.println(x + " " + y);
              max = sum(x,y);
          }
       }
       System.out.println(max);
    }
}

import java.util.Scanner;
public class banana {
	static public void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int b = sc.nextInt();
		int y = 0;
		int x = 0;
		long max_banana = 0;
		long current = 0;
		boolean running = true;
		while(running){
			y = (-1) * ((int) Math.ceil(( 1.0/(double)m ) * x)) + b;
			current = ( (y+1) * ((x * (x+1))/2) ) + ( (x+1) * ((y * (y+1))/2) );
			if(y < 0){
				running = false;
			}
			else if(current > max_banana){
				max_banana = current;
			}
			x++;
		}
		System.out.println(max_banana);
		sc.close();
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int m = in.nextInt();
            int b = in.nextInt();
            double max = 0;
            long x;
            for (x = 0; x <= b * m; x++) {
                double y = ((1D) * (-x)) / m + b;
                max = Math.max(max, ((Math.abs(x) + 1) * (Math.abs(y) + 1) * (Math.abs(x) + Math.abs(y)) / 2));
            }
            out.println(new Double(max).longValue());
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.*;
import java.util.*;

public class Main {
    public static void main (String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int m = Integer.parseInt(st.nextToken()),
            b = Integer.parseInt(st.nextToken());
        long max = 0;
        for (int y=b ; y>=0 ; y--) {
            long x = (long)Math.floor(((double)y-b)*(-m));
            long current = 0;
            for (int i=y ; i>=0 ; i--) {
                current += (i+x)*(i+x+1)/2 - (long)(i-1)*(i)/2;
            }
            max = Math.max(max, current);
        System.out.println(max);
        }
    }
}

import java.io.*;
import java.util.*;

public class B {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int m = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());

        long best = 0;
        for (int i = 0; i <= b; i++)
        {
            int x = getFirst(m, b, i);
            long tot = score(x, i);
            if (tot > best)
            {
                best = tot;
            }
        }
        System.out.println(best);
    }

    public static int getFirst(int m, int b, int y)
    {
        return (b - y) * m;
    }

    public static long score(int x, int y)
    {
        long sum = 0;
        while (y != 0)
        {
            sum += y * (x + 1) + (x * (x + 1)) / 2;
            y--;
        }

        sum += (x * (x + 1)) / 2;
        return sum;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class BananaTree {
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc=new FastReader();
		int m = sc.nextInt();
		int b = sc.nextInt();
		int ans=0;
		for(int i=0;i<=b;i++)
		{
			int x=(b-i)*m;
			ans=Math.max(((x*(x+1)*(i+1))/2)+(((i*(i+1)*(x+1))/2)), ans);
		}
		System.out.println(ans);
	}
}

import java.util.*;
public class may1{
	public static void main(String s[]){

		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int b = sc.nextInt();
		int max = Integer.MIN_VALUE;
		for(int y=b;y>=0;y--){
			int x = m*(b-y);
			int ans= (sum(x)*(y+1))+(sum(y)*(x+1));
			max = (int)Math.max((int)ans,(int)max);
		}
		System.out.println(max);
	}
	public static int sum(int x){
		return (x*(x+1))/2;
	}
}

//package CF_420;

import java.io.*;
import java.util.*;

public class b {
	public static void main(String[] args){
		Scanner sc=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int m=sc.nextInt(), b=sc.nextInt();
		int x=m*b, y=0;
		long ans=0;
		int countM=0;
		while(x>=0){
			while(countM<m){
				long tempAns=(long)((x+1)*(y+1)*(((double)x+y)/2));
				if(tempAns>ans) ans=tempAns;
				countM++;
				x--;
			}
			countM=0;
			y++;
		}
		System.out.println(ans);
	}
}

import java.util.Scanner;

public class BananaTrees {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int b = s.nextInt();
		s.close();
		int[] currCoordinate = { 0, b };
		long max = b * (b + 1) / 2;
		while (currCoordinate[1] > 0) {
			currCoordinate[1]--;
			currCoordinate[0]+=m;
			int newVal = 0;
			// sumX-coordinates
			newVal += currCoordinate[0]*(currCoordinate[0]+1)*(currCoordinate[1]+1)/2;
			//sum Y-coordinates
			newVal += currCoordinate[1]*(currCoordinate[1]+1)*(currCoordinate[0]+1)/2;
			if (newVal > max) {
				max = newVal;
			}
		}
		System.out.println(max);
	}
}

import java.util.Scanner;

public class Code1 {

    static int x0, y0;
    static int x, y;
    static int m, b;

    static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        m = in.nextInt();
        b = in.nextInt();

        int x0 = getX(0);
        int y0 = b;
        int maxSum = 0;

        if (x0 <= y0) {
            for (int i = 0; i <= x0; i++) {
                x = i;
                double yy = getY(x);
                if (Math.ceil(yy) == Math.floor(yy)) {
                    y = (int) yy;
                } else {
                    continue;
                }
                int sum = trees(x, y);
                if (sum > maxSum) {
                    maxSum = sum;
                }
            }
        } else {
            for (int i = 0; i <= y0; i++) {
                y = i;
                x = getX(y);
                int sum = trees(x, y);
                if (sum > maxSum) {
                    maxSum = sum;
                }
            }

        }
        System.out.println(maxSum);
    }

    public static int getX(int y) {
        return (b - y) * m;
    }

    public static double getY(int x) {
        return -x / (double) m + b;
    }

    public static int trees(int x, int y) {
        int sumX = x * (x + 1) / 2;
        sumX = sumX * (y + 1);

        int sumY = y * (y + 1) / 2;
        sumY = sumY * (x + 1);

        return sumX + sumY;
    }

}

import java.util.Scanner;

public class BananaTrees {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int b = s.nextInt();
		s.close();
		int[] currCoordinate = { 0, b };
		long max = b * (b + 1) / 2;
		while (currCoordinate[1] >= 0) {
			currCoordinate[1]--;
			currCoordinate[0]+=m;
			int newVal = 0;
			// sumX-coordinates
			newVal += currCoordinate[0]*(currCoordinate[0]+1)*(currCoordinate[1]+1)/2;
			//sum Y-coordinates
			newVal += currCoordinate[1]*(currCoordinate[1]+1)*(currCoordinate[0]+1)/2;
			if (newVal > max) {
				max = newVal;
			} else {
				break;
			}
		}
		System.out.println(max);
	}
}

import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;
import java.io.*;
import java.util.StringTokenizer;
public class B {
	public static void main(String[] args) throws Exception {
		FastScanner s = new FastScanner(System.in);
		int m, b;
		m=s.nextInt();
		b=s.nextInt();
		int x,y;
		x=0;
		y=b;
		int mx = b*(b+1)/2;
		while (y>=0) {
			x++;
			while (y>-(double)x/m+b) {
				y--;
			}
			if (y>=0) {
				int k = (y+1)*x*(x+1)/2+(x+1)*y*(y+1)/2;
				if (k>mx) {
					mx=k;
				}
			}
		}
		System.out.println(mx);
	}
	static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public String nextLine() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					return reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken("\n");
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class test
{
    public static void main(String args[])
    {
		int x,y,z,p;
		FastReader scan=new FastReader();
		int m=scan.nextInt();
		int b=scan.nextInt();
		long max=Long.MIN_VALUE;
		for(y=b;y>=0;y--)
		{
			x=m*(b-y);
			long val=(x+1)*(y*(y+1))/2 + (y+1)*(x*(x+1))/2;
			max=Math.max(max,val);
		}
		System.out.println(max);
	}
}
class FastReader
{
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
}

import java.io.*;
import java.util.*;

public class Main {
	static int m, b;
	static int x, y;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		m = Integer.parseInt(st.nextToken());
		b = Integer.parseInt(st.nextToken());

		x = m * b;
		y = b;
		int h = y;
		int Answer=0;
		for(int w=x/2-m;w<=x/2+m;w++){
			if(w>x)break;
			if(w%m!=0) continue;
			h = -w / m + b;
			if(h>y)break;
			int col=0, row=0;
			for(int i=0;i<=w;i++)
				col+=i;
			col=(h+1)*col;
			for(int i=0;i<=h;i++)
				row+=i;
			row=(w+1)*row;
			int sum=col+row;
			Answer=Math.max(Answer,  sum);
		}

		System.out.println(Answer);
	}
}

import java.util.*;
public class bananas
{
   static Scanner s; static int m,b; static int max=0;
   public static void main(String[] args)
   {
       System.out.println("");
       s= new Scanner(System.in);
       m=s.nextInt(); b=s.nextInt();
       int[] sols= new int[m*b];
       for (int i=0; i<m*b; i++)
       {
           if (i%m!=0) sols[i]=(int)(b+(double)(-i/m)-0.5);
          else sols[i]=-i/m+b;
        }

       if (b==0) System.out.println(0);
        else
    {
        for (int i=0; i<sols.length; i++)
        {
            if (solve(i,sols[i])>max) max=solve(i,sols[i]);
        }
    }

    System.out.println(max);
    }

    public static int solve(int a, int b)
    {
        int sum=0; int add= a*(a+1)/2;
        for (int i=0; i<=b;i++) sum=sum+add+i*(a+1);
        return sum;
    }
}

import java.util.*;

public class Darshjava
{
    public static void main(String args [])
    {
        Scanner enter = new Scanner (System.in) ;
        int m = enter.nextInt() , b = enter.nextInt()
        , x = m * b , y ;
        long bananas = 0 , max = 0 ;
        for (int i = 0 ; i <= x ; i+= m)
        {
            y = -(i/m) + b ;
            for (int j = 0 ; j <= y ; j++)
            {
                bananas += ((i+1)*(2*j+i))/2 ;
            }
            max = max > bananas ? max : bananas ;
            bananas = 0 ;
        }
        System.out.println(max);
    }
}

import java.util.Scanner;

public class B_OkabeAndBananaTrees {

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		long m = in.nextLong();
		long b = in.nextLong();

		long maxWidth = m * b;
		long maxHeight = b;

		long width = 0;
		long height = maxHeight;

		long maxBananasCount = 0;
		while(height >= 0)
		{
			long bananas = countBananas(width, height);
			if(bananas > maxBananasCount)
				maxBananasCount = bananas;
			width++;
			if(width < maxWidth)
				height = (long)((-1.0 /m) * width + b);
			else if(width == maxWidth)
				height = 0;
			else
				break;
		}

		System.out.println(maxBananasCount);

	}

	private static long countBananas(long width, long height)
	{
		//Arithmetic series sum n(n+1) / 2
		long h1 = height * (height + 1) / 2;
		long w1 = width * (width + 1) / 2;

		return h1 * (width + 1) + w1 * (height + 1);
	}
}

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);

		int m = in.nextInt();
		int b = in.nextInt();
		long max = 0;
		int mx = 0,my = 0;

		for (int i=0;i<m*b;i++){
			double x= (double) i;
			int y = (int) ((double) b - x / (double) m);
			long tx=i;
			long ty=y;
			long temp = (1+tx)*tx/2*(ty+1) + (1+ty)*ty/2*(tx+1);
//			System.out.printf("x=%d,y=%d,temp=%d\n", i,y,temp);
			if (temp>max){
				max=temp;
				mx=i;
				my=y;
			}
		}
		System.out.println(max);
	}

}

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);

		double m = in.nextDouble();
		double b = in.nextDouble();
		double max = 0;

		for (double i=0;i<m*b;i++){
			double x = i;
			double y = Math.floor(b-x/m);
			double temp = (1+x)*x/2*(y+1) + (1+y)*y/2*(x+1);
			if (temp>max){
				max=temp;
			}
		}
		System.out.println((long) max);
	}

}

import java.io.*;
import java.util.*;

public class Main {
	static int m, b;
	static int x, y;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		m = Integer.parseInt(st.nextToken());
		b = Integer.parseInt(st.nextToken());

		x = m * b;
		y = b;
		int h = y;
		int Answer=0;
		int w = x/2;
		if(w%m!=0)
			w++;
		h = -w / m + b;
		int col=0, row=0;
		for(int i=0;i<=w;i++)
			col+=i;
		col=(h+1)*col;
		for(int i=0;i<=h;i++)
			row+=i;
		row=(w+1)*row;
		int sum=col+row;
		Answer=Math.max(Answer,  sum);

		System.out.println(Answer);
	}
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

    static Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

    public static void main(String[] args) {
        int m = input.nextInt();
        int b = input.nextInt();
        long maxRew = 0;
        for (int x = 0; x < m * b; x++) {
            int y = -x / m + b;
            if (m * (b - y) != x) {
                continue;
            }
            int rew = (y + 1) * (y + x) * (x + 1) / 2;
            if (rew > maxRew) {
                maxRew = rew;
            }
        }
        System.out.println(maxRew);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int m = in.nextInt();
            int b = in.nextInt();
            double max = 0;
            long x;
            for (x = -b * m; x <= b * m; x++) {
                double y = (1D) * (-x) / m + b;
                max = Math.max(max, ((x + 1) * (y + 1) * (x + y) / 2));
            }
            out.println(new Double(max).longValue());
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.Scanner;

public class MainB {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int m = in.nextInt();
		int b = in.nextInt();
		in.nextLine();
		long max = 0;
		for(int y=0; y<=b; y++) {
			long first = (long)m*(b-y)*(m*(b-y) + 1)/2;
			long total = (long)first * (y+1) + y*(y+1)*(m*(b-y) + 1)/2;
			System.out.println(y + " " + first + " " + total);
			if(max < total)
				max = total;
			else
				break;
		}
		System.out.println(max);
		in.close();
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public final class Solution
{
	static int mod1 = (int)Math.pow(10, 9) + 7;
	static BigInteger mod = new BigInteger(mod1 + "");
    public static void main(String[] args)
    {
    	 Reader input = new Reader();
         PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
         int m = input.nextInt(), b = input.nextInt();
         int xIntersection = b * m , yIntersection = b ;
         double x ;
         long result = 0;
         for(int i = yIntersection ; i >= 0 ; i--)
         {
        	 x = (b - i) * m;
        	 if(Math.abs(x - (int)x) <= 0.0001)
        		 result += (int)x + i;
         }
         int sumX = 0;
         for(int i = 1 ; i <= xIntersection ; i++)
         {
        	 sumX += i;
        	 int y = b - (i / m);
        	 if(Math.abs(y - ((double)b - (i / (double)m))) > 0.0001)
        		 continue;
        	 int bananas = sumX * (y+1) + (y+1) * y / 2 * (i+1);
        	 if(bananas > result)
        		 result = bananas;
         }
         int sumY = 0;
         for(int i = 1 ; i <= yIntersection ; i++)
         {
        	 sumY += i;
        	 int x1 = (b - i) * m;
        	 int bananas = sumY * (x1+1) + (x1+1) * x1 / 2 * (i+1);
        	 if(bananas > result)
        		 result = bananas;
         }
         out.println(result);
         out.close();
    }
    public static class Reader
    {
    	BufferedReader br;
    	StringTokenizer st;
    	public Reader()
    	{
    		br = new BufferedReader(new InputStreamReader(System.in));
    	}
    	public String next()
    	{
    		try
    		{
        		if(st == null || !st.hasMoreTokens())
        			st = new StringTokenizer(br.readLine());
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return st.nextToken();
    	}
    	public int nextInt()
    	{
    		return Integer.parseInt(next());
    	}
    	public double nextDouble()
    	{
    		return Double.parseDouble(next());
    	}
    	public long nextLong()
    	{
    		return Long.parseLong(next());
    	}
    	public String nextLine()
    	{
    		try
    		{
    			return br.readLine();
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return "";
    	}
    }
}

import java.io.*;
import java.util.*;

public class Kek {

    static class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        void updtokin() throws IOException {
            if (!tokin.hasMoreTokens()) {
                String a = in.readLine();
                if (a != null) {
                    tokin = new StringTokenizer(a);
                }
            }
        }

        String next() throws IOException {
            updtokin();
            return tokin.nextToken();
        }

        int nextInt() throws IOException {
            updtokin();
            return Integer.parseInt(tokin.nextToken());
        }
    }

    void slave() throws IOException {
        Reader in = new Reader();
        long m = in.nextInt();
        long b = in.nextInt();
        double ans = 0;
        for (long y = 0; y <= b; y++) {
            double x = (b - y) * m;
            double a = x * ((x + 1) / 2);
            double sum = (a + y * ((x + 1) / 2)) * (y + 1);
            if (sum > ans)
                ans = sum;
        }
        System.out.print((long)ans);
    }

    public static void main(String args[]) throws IOException {
        new Kek().slave();
        //PrintWriter out = new PrintWriter(new FileWriter("bits.out"));
        //out.close();
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
	static BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
public static void main(String args[]) throws NumberFormatException, IOException {
	//next<datatype>() for input of a type
	//next<datatyoe>array() for array input of a type
	//next<datatyoe>array() for array input of a type
	int mb[] = nextIntarray();
	int m =mb[0],b=mb[1];
//	int b = nextInt();
	long x = m*b;
	long lsum=0,max=0;
	for(int i=0;i<x;i++){
		int y = (int)Math.floor((-(double)i/(double)m+(double)b));
		lsum=(long)(((long)y*(y+1))/2)*(long)(i+1)+ (((long)i*(i+1))/2)*(long)(y+1);

//		System.out.println(i+" "+y);
		max=Math.max(lsum,max);
	}
	System.out.println(max);
//############################################################################################################
    //Collections.reverse(n);

//	HashMap<Integer, Integer> hmap = new HashMap<Integer, Integer>();
//	for(Map.Entry pair: hmap.entrySet()){
//
//	}

////		it = hmap.entrySet().iterator();
////		while (it.hasNext()) {
////	        Map.Entry pair = (Map.Entry)it.next();
//////		        System.out.println(pair.getKey() + " = " + pair.getValue());
////	        ArrayList<Object> x=(ArrayList<Object>) pair.getValue();
////	        for(int i=0;i<x.size();i++){
//////	        	System.out.println(arr[(int)x.get(i)]);
////	        	if(arr[(int)x.get(i)]!=1){
//////	        		System.out.println(x.get(i)+"xxx");
////	        		int idx = (int)pair.getKey();
////	        		ans[idx]=(int)x.get(i);
////		        	arr[(int)x.get(i)]=1;
////		        	break;
////	        	}
////	        }
//////	        it.remove(); // avoids a ConcurrentModificationException
////	    }

	}

class Mycompare implements Comparator<Integer>{
	public int compare(Integer x, Integer y){
		return -1;
	}
}

public static ArrayList<Integer> findPerm(final String A, int B) {
    int cntI=0,cntD=0;
    int ni = B,nd=1;
    ArrayList<Integer> ans = new ArrayList<Integer>();
    for(int i=0;i<B-1;i++){
        if(A.charAt(i)=='D'){
            ans.add(ni);
            System.out.println(ni);
            ni=ni-1;
        }
        else{
            ans.add(nd);
            System.out.println(nd);
            nd+=1;
        }
    }
    ans.add(nd);

     for(int i=0;i<ans.size();i++){
         System.out.println("a"+ans.get(i));
     }
    return ans;
}

private static double[] nextDoublearray() throws IOException {
	String s[]=bf.readLine().split(" ");
	double arr[]=new double[s.length];
	for(int i=0;i<s.length;i++){
		arr[i]=Double.parseDouble(s[i]);
	}
	return arr;
}

private static double nextDouble() throws NumberFormatException, IOException {
	return Double.parseDouble(bf.readLine());
}

private static long GCD(long a, long b) {
	   if (b==0) return a;
	   return GCD(b,a%b);
}

private static long[] nextLongarray() throws IOException {
	String s[]=bf.readLine().split(" ");
	long arr[]=new long[s.length];
	for(int i=0;i<s.length;i++){
		arr[i]=Long.parseLong(s[i]);
	}
	return arr;
	}

private static long nextLong() throws NumberFormatException, IOException {
	return Long.parseLong(bf.readLine());
	}

private static int[] nextIntarray() throws IOException {
	String s[]=bf.readLine().split(" ");
	int arr[]=new int[s.length];
	for(int i=0;i<s.length;i++){
		arr[i]=Integer.parseInt(s[i]);
	}
	return arr;
}

private static int nextInt() throws NumberFormatException, IOException {
	return Integer.parseInt(bf.readLine());
}
private static boolean isPalindrome(String s) {

	  int n = s.length();
	  for (int i=0;i<(n / 2) + 1;++i) {
	     if (s.charAt(i) != s.charAt(n - i - 1)) {
	         return false;
	     }
	  }

	  return true;
	}
private static int factorial(int num)
{
    if (num == 0 || num == 1)
    {
        return 1;
    }
    else
    {
        return(num * factorial(num - 1));
    }
}
private static long power(long b,long e){
if (e == 0) return 1;
	    if (e%2==0) return power(b*b, e/2);
	    /* e is odd */ return b * power(b, e-1);
}
private static long lcm(long a, long b)
{
    return a * (b / GCD(a, b));
}

private static boolean isPrimeNumber(long number){

        for(long i=2; i<=number/2; i++){
            if(number % i == 0){
                return false;
            }
        }
        return true;
    }

/*COMBINATION CODE
	void combinationUtil(int arr[], int n, int r, int index, int data[], int i)
{
    // Current cobination is ready, print it
    if (index == r)
    {
        for (int j=0; j<r; j++)
            printf("%d ",data[j]);
        printf("\n");
        return;
    }

    // When no more elements are there to put in data[]
    if (i >= n)
        return;

    // current is included, put next at next location
    data[index] = arr[i];
    combinationUtil(arr, n, r, index+1, data, i+1);

    // current is excluded, replace it with next (Note that
    // i+1 is passed, but index is not changed)
    combinationUtil(arr, n, r, index, data, i+1);

	}
		 */

//PERMUTATION CODE
/*

		 void permute(char *a, int l, int r)
	{
   int i;
   if (l == r)
     printf("%s\n", a);
   else
   {
       for (i = l; i <= r; i++)
       {
          swap((a+l), (a+i));
          permute(a, l+1, r);
          swap((a+l), (a+i)); //backtrack
       }
   }
	}*/

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int m = in.nextInt();
            int b = in.nextInt();
            double max = 0;
            long x = 0;
            for (x = 0; x <= b * m; x++) {
                double y = (1D) * (-x) / m + b;
                max = Math.max(max, ((x + 1) * (y + 1) * (x + y) / 2));
            }
            out.println(Math.round(max));
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class CF420 {

	static PrintWriter pw = new PrintWriter(System.out);

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int b =sc.nextInt();
		long max = 0;
		for(int i=0; i<=b*m;i++){
			double y = -(double)i/m+b;
			if((int)y==y){
				//System.out.println(y);
				long trees = (long)((i*(i+1)/2)*(y+1)+(y*(y+1)/2)*(i+1));
				max = Math.max(trees, max);
			}
		}
		System.out.println(max);
}

static class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s) {
		br = new BufferedReader(new InputStreamReader(s));
	}

	public Scanner(String f) throws FileNotFoundException {
		br = new BufferedReader(new FileReader(f));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public int[] nextIntArray(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public int[] nextIntArray1(int n) throws IOException {
		int[] a = new int[n + 1];
		for (int i = 1; i <= n; i++)
			a[i] = nextInt();
		return a;
	}

	public int[] shuffle(int[] a, int n) {
		int[] b = new int[n];
		for (int i = 0; i < n; i++)
			b[i] = a[i];
		Random r = new Random();
		for (int i = 0; i < n; i++) {
			int j = i + r.nextInt(n - i);
			int t = b[i];
			b[i] = b[j];
			b[j] = t;
		}
		return b;
	}

	public int[] nextIntArraySorted(int n) throws IOException {
		int[] a = nextIntArray(n);
		a = shuffle(a, n);
		Arrays.sort(a);
		return a;
	}

	public long[] nextLongArray(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}

	public long[] nextLongArray1(int n) throws IOException {
		long[] a = new long[n + 1];
		for (int i = 1; i <= n; i++)
			a[i] = nextLong();
		return a;
	}

	public long[] newLongArrayC1(int n) throws IOException {
		long[] a = new long[n + 1];
		for (int i = 1; i <= n; i++) {
			a[i] = a[i - 1] + nextLong();
		}
		return a;
	}

	public long[] nextLongArraySorted(int n) throws IOException {
		long[] a = nextLongArray(n);
		Random r = new Random();
		for (int i = 0; i < n; i++) {
			int j = i + r.nextInt(n - i);
			long t = a[i];
			a[i] = a[j];
			a[j] = t;
		}
		Arrays.sort(a);
		return a;
	}
}

}

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

public class B {

  private static final String REGEX = " ";
  private static final Boolean DEBUG = false;
  private static final String FILE_NAME = "input.txt";

  public static void main(String[] args) throws IOException {
    if (DEBUG) {
      generate();
    }
    Solver solver = new Solver();
    solver.readData();
    solver.solveAndPrint();
  }

  private static void generate() throws IOException {
//    FileWriter writer = new FileWriter("input.txt");
//    writer.close();
  }

  private static class Solver {
    long m, b;

    void readData() throws IOException {
      InputStream in = DEBUG ? new FileInputStream(FILE_NAME) : System.in;
      Scanner scanner = new Scanner(in);
      m = scanner.nextLong();
      b = scanner.nextLong();
      scanner.close();
    }

    void solveAndPrint() {
      long answer = 0;
      for (long y = b; y >= 0; y--) {
        for (long x = 0; x < m * b; x++) {
          if (x > (b - y) * m) continue;
          answer = max(answer, getRes(x, y));
        }
      }
      System.out.println(answer);
    }

    private long getRes(long x, long y) {
      return (((y + x) * (x + 1)) * (y + 1)) / 2;
    }

    @SuppressWarnings("SameParameterValue")
    int[] splitInteger(String string, int n) {
      final String[] split = string.split(REGEX, n);
      int[] result = new int[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Integer.parseInt(split[i]);
      }
      return result;
    }

    public int[] splitInteger(String string) {
      return splitInteger(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    long[] splitLong(String string, int n) {
      final String[] split = string.split(REGEX, n);
      long[] result = new long[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Long.parseLong(split[i]);
      }
      return result;
    }

    public long[] splitLong(String string) {
      return splitLong(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    double[] splitDouble(String string, int n) {
      final String[] split = string.split(REGEX, n);
      double[] result = new double[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Double.parseDouble(split[i]);
      }
      return result;
    }

    public double[] splitDouble(String string) {
      return splitDouble(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    String[] splitString(String string, int n) {
      return string.split(REGEX, n);
    }

    public String[] splitString(String string) {
      return splitString(string, 0);
    }

    public int max(int a, int b) {
      return Math.max(a, b);
    }

    public long max(long a, long b) {
      return Math.max(a, b);
    }

    public int min(int a, int b) {
      return Math.min(a, b);
    }

    public long min(long a, long b) {
      return Math.min(a, b);
    }

    public double max(double a, double b) {
      return Math.max(a, b);
    }

    public double min(double a, double b) {
      return Math.min(a, b);
    }

    private final static int MOD = 1000000009;

    int multMod(int a, int b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    int sumMod(int a, int b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }

    long multMod(long a, long b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    long sumMod(long a, long b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }
  }

}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	Scanner in;
	PrintStream out;

	public void run(){
		int m = in.nextInt();
		int b = in.nextInt();
		long maxRes=-1;

		for(int y=0; y < b; y++){
			int  x = (b-y)*m;
			long currRes = ((x+1)*x*(y+1) + (y+1)*y*(x+1))/2;
			maxRes = Math.max(maxRes, currRes);
			//out.println(x+" "+y+" "+res);
		}

		out.println(maxRes);
		// close _in_ and _out_
		in.close();
		out.close();
	}

	public Main(InputStream in, OutputStream out){
		this.in = new Scanner(new BufferedInputStream(in));
		this.out = new PrintStream(new BufferedOutputStream(out));
	}

	public static void main(String[] args){
		new Main(System.in, System.out).run();
	}
}

import java.util.Scanner;

/**
 *
 * @author Destarte
 */
public class NewClass {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int m = input.nextInt();
        int b = input.nextInt();

        int my = b;
        int mx = -b * -m;

        int x0 = -1, y0 = -1;

        for (int y = my; y >= 0; y--) {
            for (int x = mx; x >= 0; x--) {
                double d = ( (double)-1/m) * x + b;
                if (y == d && (y != my && x != 0) && (x != mx && y != 0)) {
                    if (y * x >= y0 * x0) {
                        y0 = y;
                        x0 = x;
                    }
                }
            }
        }

        int soma = 0;

        for (int i = 0; i <= x0; i++) {
            for (int j = 0; j <= y0; j++) {
                soma += i+j;
            }
        }
        System.out.println(soma);

    }
}

import java.io.*;
import java.util.*;

/*
Solution Sketch:
*/

public class banana {

	static final boolean stdin = true;
	static final String filename = "";
	static FastScanner br;
	static PrintWriter pw;

	public static void main(String[] args) throws IOException {

		if (stdin) {
			br = new FastScanner();
			pw = new PrintWriter(new OutputStreamWriter(System.out));
		}

		else {
			br = new FastScanner(filename + ".in");
			pw = new PrintWriter(new FileWriter(filename + ".out"));
		}

		X solver = new X();
		solver.solve(br, pw);
	}

	static class X {
		static int m,b;
		public void solve(FastScanner br, PrintWriter pw) throws IOException {
			m = br.nextInt();
			b = br.nextInt();
			int[][] pre = new int[m*b+1][b+1];
			for(int i = 1; i <= m*b; i++) {
				pre[i][0] = pre[i-1][0] + i;
				if(i <= b) {
				pre[0][i] = pre[0][i-1] + i;
				}
			}
			for(int i = 1; i <= m*b; i++) {
				for(int j = 1; j <= b; j++) {
					pre[i][j] = (pre[i-1][j] + pre[i][j-1] + (i+j))-pre[i-1][j-1];
				}
			}
			int mx = 0;
			for(int x = 0; x <= m*b; x+= m) {
				int y = gy(x);
				pw.println(x + " " + y + " " + pre[x][y]);
				mx = Math.max(mx, pre[x][y]);
			}
			pw.println(mx);
			pw.close();
		}
		public static int gy(int x) {
			return (-1 * (x/m))+b;
		}

	}

	//fastscanner class
	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

}

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
/*
	  br = new BufferedReader(new FileReader("input.txt"));
	  pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
	  br = new BufferedReader(new InputStreamReader(System.in));
	  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
	private static BufferedReader br;
	private static StringTokenizer st;
	private static PrintWriter pw;

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//int qq = 1;
		int qq = Integer.MAX_VALUE;
		//int qq = readInt();
		for(int casenum = 1; casenum <= qq; casenum++)	{
			int m = readInt();
			int b = readInt();
			long ret = 0;
			long lhs = 0;
			long rhs = m*b;
			while(lhs + 3 < rhs) {
				long ll = (2*lhs+rhs)/3;
				long rr = (2*rhs+lhs)/3;
				if(eval(ll, m, b) < eval(rr, m, b)) {
					lhs = ll;
				}
				else {
					rhs = rr;
				}
			}
			for(long a = lhs; a <= rhs; a++) {
				ret = Math.max(ret, eval(a, m, b));
			}
			pw.println(ret);
		}
		exitImmediately();
	}

	public static long eval(long x, long m, long b) {
		long y = b - (x+m-1)/m;
		if(x < 0 || y < 0) return 0;
		return (x+1)*(y+1)*(x+y)/2;
	}

	private static void exitImmediately() {
		pw.close();
		System.exit(0);
	}

	private static long readLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private static double readDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	private static int readInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	private static String nextLine() throws IOException  {
		String s = br.readLine();
		if(s == null) {
			exitImmediately();
		}
		st = null;
		return s;
	}

	private static String nextToken() throws IOException  {
		while(st == null || !st.hasMoreTokens())  {
			st = new StringTokenizer(nextLine().trim());
		}
		return st.nextToken();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Long.max;
import static java.lang.Long.toHexString;
import static java.lang.Math.abs;
import static java.lang.Math.sin;

public class B {

    public static void main(String[] args) {

        MyScanner in = new MyScanner();

        int m = in.nextInt();
        int b = in.nextInt();

        long result = 0;

        for(int x=1;x<m*b;++x){
            int y = (int)(-1.0*x/m + b);
            result = Math.max(result, 1L*(x+1) * (y)*(y+1)/2 + (y+1)*(x)*(x+1)/2);
//            System.out.println(x+" "+y+" "+1L*(x+1) * y*(y+1)/2 );
//            System.out.println(x+" "+y+" "+1L*(y+1)*x*(x+1)/2 );
//            System.out.println(x+" "+y+" "+(1L*(x+1) * y*(y+1)/2 + 1L*(y+1)*x*(x+1)/2));
        }

        System.out.println(result);

    }

    // -----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    // --------------------------------------------------------

}

import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;

public class main implements Runnable{

    static ArrayList <Integer> adj[];
    static int co=0,f=0;

    static void Check2(int n){
        adj=new ArrayList[n+1];
        for(int i=0;i<=n;i++){
            adj[i]=new ArrayList<>();
        }

    }
    static void add(int i,int j){

        adj[i].add(j);
         }
    public static void main(String[] args)  {
        new Thread(null, new main(), "Check2", 1<<26).start();// to increse stack size in java
    }
    static long mod=(long)(1e9+7);
    public void run() {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        //Scanner in=new Scanner(System.in);

        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long m=in.nextLong();
        long b=in.nextLong();

        long x=m*b;
        long y=b;

        long i=1;
        long j=y-1;

        long max=0;
        while(j>0){
        long p=m*(b-j);
            long ans=((p+1)*(j*(j+1)))/2;
            long ans2=j*((p)*(p+1))/2;
            max=max(max,ans+ans2+p*(p+1)/2);
            j--;
        }

        max=max(max,m*b);
        max=max(max,y);

        w.println(max);

        w.close();
    }
    static  void dfs(int i,int v[],int v2[],int edge){

        if(v[i]==1)return ;
        v[i]=1;
        v2[i]=1;
        Iterator <Integer> it=adj[i].iterator();
        while(it.hasNext()){
            int q=it.next();
            dfs(q,v,v2,edge+1);
        }

    }

    static long power(long x,long y){
        if(y==0)return 1%mod;
        if(y==1)return x%mod;

        long res=1;
        x=x%mod;
        while(y>0){

            if((y%2)!=0){
                res=(res*x)%mod;
            }

            y=y/2;
            x=(x*x)%mod;
        }

        return res;

    }

    static  int gcd(int a,int b){

        if(b==0)return a;
        return gcd(b,a%b);
    }

    static  void sev(int a[],int n){

        for(int i=2;i<=n;i++)a[i]=i;
        for(int i=2;i<=n;i++){

            if(a[i]!=0){
                for(int j=2*i;j<=n;){

                    a[j]=0;
                    j=j+i;
                }
            }

        }

    }

    static class pair implements Comparable<pair> {

        int x,y;
        pair(int c,int d){
            x=c;
            y=d;
        }

        public int compareTo(pair o){

            return (this.x-o.x);   //sort in incrementing order w.r.t to c
        }

    }

    static class node{

        int y;
        int val;

        node(int a,int b){

            y=a;
            val=b;

        }

    }

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

}

	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.io.PrintWriter;
	import java.util.ArrayList;
	import java.util.Arrays;
	import java.util.Map.Entry;
	import java.util.PriorityQueue;
	import java.util.StringTokenizer;
	import java.util.*;

	   public class Solution {

		/*public static int ispr(int n)
	    	{
	    	//boolean[] isPrime = new boolean[n+1];
	        for (int i = 2; i <= n; i++) {
	            Prime[i] = true;
	        }

	        // mark non-primes <= n using Sieve of Eratosthenes
	        for (int factor = 2; factor*factor <= n; factor++) {

	            // if factor is prime, then mark multiples of factor as nonprime
	            // suffices to consider mutiples factor, factor+1, ...,  n/factor
	            if (Prime[factor]) {
	                for (int j = factor; factor*j <= n; j++) {
	                    Prime[factor*j] = false;
	                }
	            }
	        }
	        // count primes

	        /*int primes = 0;
	        for (int i = 2; i <= n; i++) {
	            if (isPrime	[i])System.out.println(i);

	        }*/
		// System.out.println("The number of primes <= " + n + " is " + primes);
		//return 0;
		// if(isPrime[n]==true)return 1; else return 0;

		//}

		public static long fact(long x)
		{
			if(x==0)return 1;
			else return x*fact(x-1);
		}

		public static long exp(long x, long n, long M)
		{

			if(n==0) return 1;

			else if(n%2==0) return exp((x*x)%M,n/2,M);
			else return (x*exp((x*x)%M,(n-1)/2,M))%M;

		}

		//fi

		static long fib(long n)
		{
			long F[][] = new long[][]{{1,1},{1,0}};
			if (n == 0)
				return 0;
			power(F, n-1);

			return F[0][0];
		}

		static int mod=1000000007;

		static void multiply(long F[][], long M[][])
		{
			long x =  (((F[0][0]%mod)*(M[0][0]%mod))%mod + ((F[0][1]%mod)*(M[1][0]%mod))%mod)%mod;
			long y =  (((F[0][0]%mod)*(M[0][1]%mod))%mod + ((F[0][1]%mod)*(M[1][1]%mod))%mod)%mod;
			long z =  (((F[1][0]%mod)*(M[0][0]%mod))%mod + ((F[1][1]%mod)*(M[1][0]%mod))%mod)%mod;
			long w =  (((F[1][0]%mod)*(M[0][1]%mod))%mod + ((F[1][1]%mod)*(M[1][1]%mod))%mod)%mod;

			F[0][0] = x;
			F[0][1] = y;
			F[1][0] = z;
			F[1][1] = w;
		}

		/* Optimized version of power() in method 4 */
		static void power(long F[][], long n)
		{
			if( n == 0 || n == 1)
				return;
			long M[][] = new long[][]{{1,1},{1,0}};

			power(F, n/2);
			multiply(F, F);

			if (n%2 != 0)
				multiply(F, M);
		}

		public static int gcd(int a, int b)
		{
			if(b==0)
				return a;
			else return gcd(b,a%b);
		}

		static  class MyScanner {

			BufferedReader br;
			StringTokenizer st;

			public MyScanner() {
				br = new BufferedReader(new InputStreamReader(System.in));
			}

			String next() {
				while (st == null || !st.hasMoreElements()) {
					try {
						st = new StringTokenizer(br.readLine());
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}

			int nextInt() {
				return Integer.parseInt(next());
			}

			long nextLong() {
				return Long.parseLong(next());
			}

			double nextDouble() {
				return Double.parseDouble(next());
			}

			String nextLine(){
				String str = "";
				try {
					str = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				return str;
			}

		}

		static MyScanner sc = new  MyScanner();
		static PrintWriter pw = new PrintWriter(System.out, true);

		static void printPath(int parent[], int j)
		{
		    // Base Case : If j is source
		    if (parent[j]==-1)
		        {pw.print(j+" ");return;}

		    printPath(parent, parent[j]);

		    pw.print(j+" ");
		}

		//Main begins here :)
	/*
		public static class Pair{
		    int a;
		    int b;
		    Pair(int p,int q){
		        a=p;
		        b=q;
		    }
		    public boolean equals(Object o) {
		        if (o instanceof Pair) {
		            Pair p = (Pair)o;
		            return p.a == a && p.b == b;
		        }
		        return false;
		    }
		    public int hashCode() {
		        return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		    }
		}
		*/

		public static int max1(String st, int k)
		{
			int n1=0;
			int max=Integer.MIN_VALUE;
			int n = st.length();
			if(n==1)
			{
				if(st.charAt(0)=='1')return 1;
				else return 0;
			}

			for(int i=1;i<=k;i++)
			{
				int chp=i-1;

				if(st.charAt(chp)=='1')n1++;

			}
			max=Math.max(max, n1);
		//	if(k>=n)return max;
			int slides=n-k;
			int ptr1=0, ptr2=k-1;

			for(int i=1;i<=slides;i++)
			{
				//pw.println(st.substring(ptr1+i, ptr2+i+1));
				ptr1++; ptr2++;
				if(st.charAt(ptr1-1)=='1')n1--;
				if(st.charAt(ptr2)=='1')n1++;
				//pw.println("m1- "+n1);pw

				if(n1>max)max=n1;
				if(max==k){return k;}
			}

			return max;

		}

		public static String shift(String A)
		{
			char lc = A.charAt(A.length()-1);
			return lc+A.substring(0,A.length()-1);

		}

		static  class Point
		{
			long x,y;

			public Point(long a, long b)
			{
				x=a;
				y=b;
			}

			public int compareTo(Point o) {
				// TODO Auto-generated method stub
				return Long.compare(this.x, o.x);

			}

		}

		static class compx implements Comparator<Point>
		{
			public int compare(Point a, Point b)
			{

				if(a.x>b.x)return 1;
				if(a.x<b.x) return -1;

				return 0;
			}
		}

		static class compy implements Comparator<Point>
		{
			public int compare(Point a, Point b)
			{

				if(a.y>b.y)return 1;
				if(a.y<b.y) return -1;

				return 0;
			}
		}

		public static int lucky(long y)
		{

			long d = y;
			int flg=0;
			//long nd = (long)Math.floor(Math.log10((double)y));
			//pw.println(nd);
			for(;d>=1;d=d/10)
			{
				long dg = d%10;
				if(dg!=0)flg++;
				if(flg==2)return 0;

			}
			return 1;

		}

		public static int diff(Time n, Time k)
		{

			int hn=n.h,mn=n.m,sn=n.s;
			int hk=k.h,mk=k.m,sk=k.s;

			int tc=0,cs=0,cm=0,ch=0;
			if(sk>sn)
			{
				int o1 = sk-sn;
				int o2 = sn+60-sk;

				if(o1>o2)
				{
					cs=o2;
					mn--;
				}
				if(o2>o1)
				{
					cs=o1;
				}
				if(o1==o2)
				{

					int min1 = Math.min(Math.abs(mk-mn), 60 - Math.abs(mk-mn));
					int mn2 = mn-1;
					int min2  = Math.min(Math.abs(mk-mn2), 60 - Math.abs(mk-mn2));
					if(min2<min1)
					{
						cs=o2;
						mn--;
					}
					else
					{
						cs=o1;
					}

				}
			}

			if(sk<sn)
			{
				int o1 = sn-sk;
				int o2 = sk+60-sn;

				if(o1>o2)
				{
					cs=o2;
					mn++;
				}
				if(o2>o1)
				{
					cs=o1;
				}
				if(o1==o2)
				{

					int min1 = Math.min(Math.abs(mk-mn), 60 - Math.abs(mk-mn));
					int mn2 = mn+1;
					int min2  = Math.min(Math.abs(mk-mn2), 60 - Math.abs(mk-mn2));
					if(min2<min1)
					{
						cs=o2;
						mn++;
					}
					else
					{
						cs=o1;
					}

				}
			}

			if(mk>mn)
			{
				int o1 = mk-mn;
				int o2 = mn+60-mk;

				if(o1>o2)
				{
					cm=o2;
					hn--;
				}
				if(o2>o1)
				{
					cm=o1;
				}
				if(o1==o2)
				{
					int min1 = Math.min(Math.abs(hk-hn), 24 - Math.abs(hk-hn));
					int hn2 = hn-1;
					int min2  = Math.min(Math.abs(hk-hn2), 24 - Math.abs(hk-hn2));
					if(min2<min1)
					{
						cm=o2;
						hn--;
					}
					else
					{
						cm=o1;
					}
				}
			}

			if(mk<mn)
			{
				int o1 = mn-mk;
				int o2 = mk+60-mn;

				if(o1>o2)
				{
					cm=o2;
					hn++;
				}
				if(o2>o1)
				{
					cm=o1;
				}
				if(o1==o2)
				{
					int min1 = Math.min(Math.abs(hk-hn), 24 - Math.abs(hk-hn));
					int hn2 = hn+1;
					int min2  = Math.min(Math.abs(hk-hn2), 24 - Math.abs(hk-hn2));
					if(min2<min1)
					{
						cm=o2;
						hn++;
					}
					else
					{
						cm=o1;
					}
				}
			}

			ch = Math.min(Math.abs(hk-hn), 24 - Math.abs(hk-hn));
			tc=cs+cm+ch;
			return tc;

			//return 3;
		}

		public static class Time
		{
			int h,m,s;

			public Time(int x, int y, int z)
			{
				h=x; m=y; s=z;

			}

		}

		static class Pair
		{
		    int x;
		    int y;

		    public Pair(int a , int b)
		    {
		        x=a;
		        y=b;
		    }

		}

		static class comp implements Comparator<Pair>
		{

		    @Override

		    public int compare(Pair a ,Pair b)
		    {
		        if(b.x>a.x)return -1;
		        if(b.x<a.x)return 1;
		        return 0;

		    }

		}
		static class compv implements Comparator<Vouch>
		{

		    @Override

		    public int compare(Vouch a ,Vouch b)
		    {
		        if(b.c>a.c)return -1;
		        if(b.c<a.c)return 1;
		        return 0;

		    }

		}

		static class Vouch
		{
		   int l,r, c;

		    public Vouch(int a ,int b, int ci)
		    {
		        l=a;
		        r=b;
		        c=ci;

		    }

		}

		public static int strStr(final String haystack, final String needle) {

			if(needle.equals("")) return -1;
		    if(haystack.equals("")&&needle.equals(""))return -1;

		    String temp="";

		    int hl = haystack.length();
		    int nl = needle.length();
		    if(nl>hl) return -1;
		    int ret=-1;
	        String wind = haystack.substring(0,nl);
	        pw.println(wind);
	        if(wind.equals(needle)) return 0;

	        for(int i=1;i<hl-nl;i++)
	        {
	            wind = wind.substring(1, wind.length());

	            wind = wind+haystack.charAt(i+nl);

	            pw.println(i+" "+wind);
	            if(wind.equals(needle))
	            {
	                ret=i; break;
	            }

	        }

	        return (ret==-1)?-1:ret;

			}

		public static int diff(String a, String b)
		{
			int ret=0;
			for(int i=0;i<a.length();i++)
			{
				if(a.charAt(i)!=b.charAt(i))ret++;
			}
			return ret;
		}

		public static boolean inter(Vouch a, Vouch b)
		{
			//return true if there's intersection
			int s1 = a.l;
			int e1 = a.r;

			int s2 = b.l;
			int e2 = b.r;

			if(s1<s2)
			{
				if(e1>=s2)return true;
				else return false;
			}
			else if(s1>s2)
			{
				if(e2>=s1) return true;
				else return false;
			}
			else
			{
				return true;
			}

		}
		public static void main(String[] args) {

			int m = sc.nextInt();
			int b = sc.nextInt();
			long max = Long.MIN_VALUE;
			for(int x=0;x<=m*b;x+=m)
			{

					int y = b - (x/m);
					long area = (((y+1)*(x)*(x+1))/2)+(((x+1)*(y+1)*y)/2);
					max=Math.max(max, area);

			}
			pw.println(max);

			    pw.close();

		}

	}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Amine
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastInput in = new FastInput(inputStream);
        FastOutput out = new FastOutput(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastInput in, FastOutput out) {
            int m = in.nextInt();
            int b = in.nextInt();
            long max = 0;
            for (int i = 0; i < m * b + 1; i++) {
                double lim = (double) -i / (double) m;
                lim += b;
                int y = (int) Math.floor(lim);
                long res = res(i, y);
                if (res > max) {
                    max = res;
                }
            }
            out.println(max);

        }

        public long res(int x, int y) {
            return ((x * (x + 1) * (y + 1) / 2) + (y * (y + 1) * (x + 1) / 2));
        }

    }

    static class FastInput {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastInput.SpaceCharFilter filter;

        public FastInput(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class FastOutput {
        private final PrintWriter writer;

        public FastOutput(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public FastOutput(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }
}

import java.util.Scanner;

public class BananaTrees {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int b = s.nextInt();
		s.close();
		int[] currCoordinate = { 0, b };
		long max = b * (b + 1) / 2;
		while (currCoordinate[1] > 0) {
			currCoordinate[1]--;
			currCoordinate[0]+=m;
			int newVal = 0;
			// sumX-coordinates
			newVal += currCoordinate[0]*(currCoordinate[0]+1)*(currCoordinate[1]+1)/2;
			//sum Y-coordinates
			newVal += currCoordinate[1]*(currCoordinate[1]+1)*(currCoordinate[0]+1)/2;
			if (newVal > max) {
				max = newVal;
			}
		}
		System.out.println(max);
	}
}

import java.util.*;
public class bananas
{
   static Scanner s; static int m,b; static int max=0;
   public static void main(String[] args)
   {
       System.out.println("");
       s= new Scanner(System.in);
       m=s.nextInt(); b=s.nextInt();
       int[] sols= new int[m*b];
       for (int i=0; i<m*b; i++)
       {
           if (i%m!=0) sols[i]=(int)(b+(double)(-i/m)-0.5);
          else sols[i]=-i/m+b;
        }

       if (b==0) System.out.println(0);
        else
    {
        for (int i=0; i<sols.length; i++)
        {
            if (solve(i,sols[i])>max) max=solve(i,sols[i]);
        }
    }

    System.out.println(max);
    }

    public static int solve(int a, int b)
    {
        int sum=0; int add= a*(a+1)/2;
        for (int i=0; i<=b;i++) sum=sum+add+i*(a+1);
        return sum;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class BananaTree {
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc=new FastReader();
		int m = sc.nextInt();
		int b = sc.nextInt();
		int ans=0;
		for(int i=0;i<=b;i++)
		{
			int x=(b-i)*m;
			ans=Math.max(((x*(x+1)*(i+1))/2)+(((i*(i+1)*(x+1))/2)), ans);
		}
		System.out.println(ans);
	}
}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	Scanner in;
	PrintStream out;

	public void run(){
		int m = in.nextInt();
		int b = in.nextInt();
		long maxRes=0;

		for(int y=0; y <= b; y++){
			int  x = (b-y)*m;
			long currRes = ((x+1)*x*(y+1) + (y+1)*y*(x+1))/2;
			maxRes = Math.max(maxRes, currRes);
			//out.println(x+" "+y+" "+res);
		}

		out.println(maxRes);
		// close _in_ and _out_
		in.close();
		out.close();
	}

	public Main(InputStream in, OutputStream out){
		this.in = new Scanner(new BufferedInputStream(in));
		this.out = new PrintStream(new BufferedOutputStream(out));
	}

	public static void main(String[] args){
		new Main(System.in, System.out).run();
	}
}

import java.io.*;
import java.util.*;

public class Main
{
    static BufferedReader in;
    static PrintWriter out;
    static boolean nOut = true;

    static void solve() throws Exception{
        int m = nextInt();
        int b = nextInt();
        long maxBananov = 0;
        for (int i = b; i >= 0; i--)
        {
            int peresecheniePramoySGraphicom_X = m*(b-i);
            long banani = 0;
            long sumY;
            if(i % 2 == 0)
                sumY = ((i+1)*i/2)*(peresecheniePramoySGraphicom_X+1);
            else
                sumY = ((i+1)/2*i)*(peresecheniePramoySGraphicom_X+1);
            long sumX;
            if(peresecheniePramoySGraphicom_X % 2 == 0)
                sumX = (i+1)*(peresecheniePramoySGraphicom_X/2*(peresecheniePramoySGraphicom_X+1));
            else
                sumX = (i+1)*((peresecheniePramoySGraphicom_X+1)/2*peresecheniePramoySGraphicom_X);
            banani+=sumY;
            banani+=sumX;
            if(banani > maxBananov) maxBananov = banani;
        }

        out.print(maxBananov);

    }

    static class MyQueue{
        int maxSize;
        int[] array;
        int head;
        int tail;
        int nItems;

        public MyQueue(int maxSize){
            this.maxSize = maxSize;
            array = new int[maxSize];
            head = 0;
            tail = 0;
            nItems = 0;
        }

        public void push(int x){

        }
    }

    public static void main(String[] args) throws Exception
    {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        if(nOut)
            out.flush();
    }

    static boolean isSpaceChar(char c){
        return c == ' ' || c == '\n' || c == '\r' || c == '\t';
    }

    static int min(int a,int b){
        return a < b ? a : b;
    }

    static int max(int a,int b){
        return a > b ? a : b;
    }

    static int nextInt() throws Exception{
        char c = (char)in.read();
        while(isSpaceChar(c)){
            c = (char)in.read();
        }

        int sign = 1;
        if(c == '-')
        {
            sign = -1;
            c = (char)in.read();
        }

        int k = 0;
        while(c <= '9' && c >='0'){
            k*=10;
            k+=c-'0';
            c = (char)in.read();
        }
        return k*sign;
    }

    static long nextLong() throws Exception{
        char c = (char)in.read();
        while(isSpaceChar(c)){
            c = (char)in.read();
        }

        int sign = 1;
        if(c == '-')
        {
            sign = -1;
            c = (char)in.read();
        }

        long k = 0;
        while(c <= '9' && c >='0'){
            k*=10;
            k+=c-'0';
            c = (char)in.read();
        }
        return k*sign;
    }

    /* static int nextInt() throws Exception{
        in.nextToken();
        return (int)in.nval;
    }

    static byte nextByte() throws Exception{
        in.nextToken();
        return (byte)in.nval;
    }

    static long nextLong() throws Exception{
        in.nextToken();
        return (long)in.nval;
    }*/
}

import java.io.*;
import java.util.*;

public class Kek {

    static class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        void updtokin() throws IOException {
            if (!tokin.hasMoreTokens()) {
                String a = in.readLine();
                if (a != null) {
                    tokin = new StringTokenizer(a);
                }
            }
        }

        String next() throws IOException {
            updtokin();
            return tokin.nextToken();
        }

        int nextInt() throws IOException {
            updtokin();
            return Integer.parseInt(tokin.nextToken());
        }
    }

    void slave() throws IOException {
        Reader in = new Reader();
        int m = in.nextInt();
        int b = in.nextInt();
        long ans = 0;
        for (int y = 0; y <= b; y++) {
            int x = (b - y) * m;
            long a = x * (x + 1) / 2;
            long sum = ((a * 2 + y * (x + 1)) * (y + 1)) / 2;
            if (sum > ans)
                ans = sum;
        }
        System.out.print(ans);
    }

    public static void main(String args[]) throws IOException {
        new Kek().slave();
        //PrintWriter out = new PrintWriter(new FileWriter("bits.out"));
        //out.close();
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int b = sc.nextInt();

        int x = -1;
        int y = -1;
        long square = -1;
        int count = 0;
        for (int i = b - 1; i >= 0; i--) {
            int nearestX = m * (b - i);
            long tempSquare = nearestX * i;
            if (tempSquare > square) {
                square = tempSquare;
                x = nearestX;
                y = i;
            } else if (tempSquare == square) {
                if (Math.abs(x - y) < Math.abs(nearestX - i)) {
                    square = tempSquare;
                    x = nearestX;
                    y = i;
                }
            } else {
                if (x > 0 || y > 0) {
                    count += (y + 1) * x * (x + 1) / 2;
                    count += y * (y + 1) / 2;
                    int temp = 0;
                    for (int j = 1; j <= y; j++) {
                        temp += x * j;
                    }
                    count += temp;
                }
                break;
            }
        }

        System.out.println(count);
    }

    public static void p(Object obj) {
        System.out.println(obj);
    }
}

import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;
import java.io.*;
import java.util.StringTokenizer;
public class B {
	public static void main(String[] args) throws Exception {
		FastScanner s = new FastScanner(System.in);
		int m, b;
		m=s.nextInt();
		b=s.nextInt();
		int x,y;
		x=0;
		y=b;
		int mx = b*(b+1)/2;
		while (y>0) {
			x++;
			while (y>-(double)x/m+b) {
				y--;
			}
			if (y>=0) {
				int k = (y+1)*x*(x+1)/2+(x+1)*y*(y+1)/2;
				if (k>mx) {
					mx=k;
				}
			}
		}
		System.out.println(mx);
	}
	static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public String nextLine() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					return reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken("\n");
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int m = in.nextInt();
            int b = in.nextInt();
            long ans = 0;
            for (int i = b; i > 0; i--) {
                int t = m * (b - i);
                long sum = ((i + 1) * i / 2) * (t + 1) + (t * (t + 1) / 2) * (i + 1);
                ans = Math.max(sum, ans);
            }
            out.println(ans);
        }

    }
}

import java.io.*;
import java.util.*;

public class Kek {

    static class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        void updtokin() throws IOException {
            if (!tokin.hasMoreTokens()) {
                String a = in.readLine();
                if (a != null) {
                    tokin = new StringTokenizer(a);
                }
            }
        }

        String next() throws IOException {
            updtokin();
            return tokin.nextToken();
        }

        int nextInt() throws IOException {
            updtokin();
            return Integer.parseInt(tokin.nextToken());
        }
    }

    void slave() throws IOException {
        Reader in = new Reader();
        long m = in.nextInt();
        long b = in.nextInt();
        double ans = 0;
        for (long y = 0; y <= b; y++) {
            double x = (b - y) * m;
            double a = x * ((x + 1) / 2);
            double sum = (a + y * ((x + 1) / 2)) * (y + 1);
            if (sum > ans)
                ans = sum;
        }
        System.out.print((long)ans);
    }

    public static void main(String args[]) throws IOException {
        new Kek().slave();
        //PrintWriter out = new PrintWriter(new FileWriter("bits.out"));
        //out.close();
    }
}

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
/*
	  br = new BufferedReader(new FileReader("input.txt"));
	  pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
	  br = new BufferedReader(new InputStreamReader(System.in));
	  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
	private static BufferedReader br;
	private static StringTokenizer st;
	private static PrintWriter pw;

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//int qq = 1;
		int qq = Integer.MAX_VALUE;
		//int qq = readInt();
		for(int casenum = 1; casenum <= qq; casenum++)	{
			int m = readInt();
			int b = readInt();
			long ret = 0;
			long lhs = 0;
			long rhs = 1000000000;
			while(lhs + 3 < rhs) {
				long ll = (2*lhs+rhs)/3;
				long rr = (2*rhs+lhs)/3;
				if(eval(ll, m, b) < eval(rr, m, b)) {
					lhs = ll;
				}
				else {
					rhs = rr;
				}
			}
			for(long a = lhs; a <= rhs; a++) {
				ret = Math.max(ret, eval(a, m, b));
			}
			pw.println(ret);
		}
		exitImmediately();
	}

	public static long eval(long x, long m, long b) {
		long y = b - (x+m-1)/m;
		if(x < 0 || y < 0) return 0;
		return (x+1)*(y+1)*(x+y)/2;
	}

	private static void exitImmediately() {
		pw.close();
		System.exit(0);
	}

	private static long readLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private static double readDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	private static int readInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	private static String nextLine() throws IOException  {
		String s = br.readLine();
		if(s == null) {
			exitImmediately();
		}
		st = null;
		return s;
	}

	private static String nextToken() throws IOException  {
		while(st == null || !st.hasMoreTokens())  {
			st = new StringTokenizer(nextLine().trim());
		}
		return st.nextToken();
	}
}

import java.util.*;

import java.io.*;
import java.math.*;
 public class Q1 {

	static ArrayList<Integer> adj[],adj2[];
	static int color[],cc;
	static long mod=1000000007;
	static TreeSet<Integer> ts;
	static boolean b[],visited[],possible,ans1,ans2;
	static Stack<Integer> s;
	static int totalnodes,colored,minc;
	static int c[],a[],n,parent[],ans[],size[];
	static long sum[];
	static HashMap<Integer,Integer> hm;
	public static void main(String[] args) throws IOException {

		//Scanner sc=new Scanner(System.in);
		in=new InputReader(System.in);
		out=new PrintWriter(System.out);
		int m=in.nextInt();
		int b=in.nextInt();
		int y=b;
		int x=(b*m);
		double midx=(double)(x)/2;double midy=(double)(y)/2;
		if(midx==Math.floor(midx) && midy==Math.floor(midy))
		{
			long ans=(long)(midx+1)*((long)(midy*(midy+1))/2);
			 ans+=(long)(midy+1)*((long)(midx*(midx+1))/2);
			out.println(ans);
		}
		else
		{

				int ans1=(int)((int)(midx/m)+1)*m;
				int ans2=-(ans1/m)+b;
				long ans=(long)(ans1+1)*((long)(ans2*(ans2+1))/2);
				 ans+=(long)(ans2+1)*((long)(ans1*(ans1+1))/2);
				out.println(ans);

		}

		out.close();
		}
	static int check(int m)
	{
		int c=0;
		for(int i=0;i<n-1;i++)
		{
			int l=i;
			int r=n-1;
			while(l<r)
			{
				int mid=(l+r)/2;

				if(a[i]+m+1>a[mid])
					l=mid+1;
				else
					r=mid;
			}
		//debug(" l****** "+l);
			if(!(a[l]-a[i]<=m))
			while(a[l]==a[l-1])
				l--;

		//	debug((l-1-(i)));
			if(l==n-1 && !(a[l]-a[i]>m) )
				c=c+l-i;
			else
			c=c+(l-1-(i));
		}

		return c;
	}
	static InputReader in;
	static PrintWriter out;
 	static void dfs(int i)
	{
 		 size[i]=1;int badabeta=0;
 		 for(int j=0;j<adj[i].size();j++)
 		 {
 			 int son=adj[i].get(j);
 			 dfs(son);
 			 size[i]+=size[son];

 			 if(size[son]>size[badabeta])
 				 badabeta=son;
 		 }
 		 if(size[badabeta]*2>size[i])
 		 {
 			 int dada = ans[badabeta];
 			 while((size[i]-size[dada])*2>size[i])
 				 dada=parent[dada];
 			 ans[i]=dada;
 		 }

	}
	/*public static void seive(long n){
		b = new boolean[(int) (n+1)];
	Arrays.fill(b, true);

		for(int i = 2;i*i<=n;i++){
			if(b[i]){
				sum[i]=count[i];
			//	System.out.println(sum[i]+" wf");
				for(int p = 2*i;p<=n;p+=i){
					b[p] = false;
					sum[i]+=count[p];
					//System.out.println(sum[i]);
				}
			}

		}
	}*/
	static class Pair implements Comparable<Pair> {
		int i;
		int j;
		//int index;
		public Pair(){

		}
		public Pair(int u, int v) {
			this.i = u;
			this.j= v;

		}
		public int compareTo(Pair other) {

				return this.j-other.j;
		}

		/*public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}*/
	}
	static class Node2{
		Node2 left = null;
		Node2 right = null;
		Node2 parent = null;
		int data;
	}

	//binaryStree
	static class BinarySearchTree{
		Node2 root = null;
		int height = 0;
		int max = 0;
		int cnt = 1;
		ArrayList<Integer> parent = new ArrayList<>();
		HashMap<Integer, Integer> hm = new HashMap<>();
		public void insert(int x){
			Node2 n = new Node2();
			n.data = x;
			if(root==null){
				root = n;
			}
			else{
				Node2 temp = root,temp2 = null;
				while(temp!=null){
					temp2 = temp;
					if(x>temp.data) temp = temp.right;
					else temp = temp.left;
				}
				if(x>temp2.data) temp2.right = n;
				else temp2.left = n;
				n.parent = temp2;
				parent.add(temp2.data);
			}
		}
		public Node2 getSomething(int x, int y, Node2 n){
			if(n.data==x || n.data==y) return n;
			else if(n.data>x && n.data<y) return n;
			else if(n.data<x && n.data<y) return getSomething(x,y,n.right);
			else return getSomething(x,y,n.left);
		}
		public Node2 search(int x,Node2 n){
			if(x==n.data){
				max = Math.max(max, n.data);
				return n;
			}
			if(x>n.data){
				max = Math.max(max, n.data);
				return search(x,n.right);
			}
			else{
				max = Math.max(max, n.data);
				return search(x,n.left);
			}
		}
		public int getHeight(Node2 n){
			if(n==null) return 0;
			height = 1+ Math.max(getHeight(n.left), getHeight(n.right));
			return height;
		}
	}
public static void debug(Object... o) {
	System.out.println(Arrays.deepToString(o));
}

public static String rev(String s)
{
	StringBuilder sb=new StringBuilder(s);
	sb.reverse();
	return sb.toString();
}

static long lcm(long a, long b)
{
    return a * (b / gcd(a, b));
}

static long gcd(long a, long b)
{
    while (b > 0)
    {
        long temp = b;
        b = a % b; // % is remainder
        a = temp;
    }
    return a;
}

public static long max(long x, long y, long z){
		if(x>=y && x>=z) return x;
		if(y>=x && y>=z) return y;
		return z;
	}
	static int[] sieve(int n,int[] arr)
	{
	for(int i=2;i*i<=n;i++)
	{
		if(arr[i]==0)
		{
			for(int j=i*2;j<=n;j+=i)
				arr[j]=1;
		}
	}
	return arr;
	}

static class InputReader {

private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;

public InputReader(InputStream stream) {
  this.stream = stream;
}

public int snext() {
  if (snumChars == -1)
    throw new InputMismatchException();
  if (curChar >= snumChars) {
    curChar = 0;
    try {
      snumChars = stream.read(buf);
    } catch (IOException e) {
      throw new InputMismatchException();
    }
    if (snumChars <= 0)
      return -1;
  }
  return buf[curChar++];
}

public int nextInt() {
  int c = snext();
  while (isSpaceChar(c)) {
    c = snext();
  }
  int sgn = 1;
  if (c == '-') {
    sgn = -1;
    c = snext();
  }
  int res = 0;
  do {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  } while (!isSpaceChar(c));
  return res * sgn;
}

public long nextLong() {
  int c = snext();
  while (isSpaceChar(c)) {
    c = snext();
  }
  int sgn = 1;
  if (c == '-') {
    sgn = -1;
    c = snext();
  }
  long res = 0;
  do {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  } while (!isSpaceChar(c));
  return res * sgn;
}

public int[] nextIntArray(int n) {
	 return nextIntArray(n, 0);
	    }

public int[] nextIntArray(int n, int off) {
	 int[] arr = new int[n + off];
	   for (int i = 0; i < n; i++) {
	    arr[i + off] = nextInt();
	    }
	    return arr;
	    }

public long[] nextLongArray(int n) {
return nextLongArray(n, 0);
	    }

	public long[] nextLongArray(int n, int off) {
	 long[] arr = new long[n + off];
	 for (int i = 0; i < n; i++) {
		  arr[i + off] = nextLong();
		 }
 return arr;
	}

public String readString() {
  int c = snext();
  while (isSpaceChar(c)) {
    c = snext();
  }
  StringBuilder res = new StringBuilder();
  do {
    res.appendCodePoint(c);
    c = snext();
  } while (!isSpaceChar(c));
  return res.toString();
}

public String nextLine() {
  int c = snext();
  while (isSpaceChar(c))
    c = snext();
  StringBuilder res = new StringBuilder();
  do {
    res.appendCodePoint(c);
    c = snext();
  } while (!isEndOfLine(c));
  return res.toString();
}

public boolean isSpaceChar(int c) {
  if (filter != null)
    return filter.isSpaceChar(c);
  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}

private boolean isEndOfLine(int c) {
  return c == '\n' || c == '\r' || c == -1;
}

public interface SpaceCharFilter {
  public boolean isSpaceChar(int ch);
}
}

}

import java.util.*;

public class CF821B {
    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);
        int m = inp.nextInt();
        int b = inp.nextInt();
        int x = b / 2;
        int y = (b - x) * m;
        int bananas = ((y * (y+1) * (x+1))/ 2) + ((x * (x+1) * (y+1)) / 2);
        System.out.println(bananas);
    }
}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	Scanner in;
	PrintStream out;

	public void run(){
		int m = in.nextInt();
		int b = in.nextInt();
		double res=-1;

		for(int y=0; y < b; y++){
			int  x = (b - y)*m;
			if (res < (x+1)/2.0*x*(y+1) + (y+1)/2.0*y*(x+1)){
				res = (x+1)/2.0*x*(y+1) + (y+1)/2.0*y*(x+1);
			}
			//out.println(x+" "+y+" "+res);
		}

		out.println(((Double) res).intValue());
		// close _in_ and _out_
		in.close();
		out.close();
	}

	public Main(InputStream in, OutputStream out){
		this.in = new Scanner(new BufferedInputStream(in));
		this.out = new PrintStream(new BufferedOutputStream(out));
	}

	public static void main(String[] args){
		new Main(System.in, System.out).run();
	}
}

import java.util.*;
 public class OkabeAndBananaTree {
    public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int m=sc.nextInt();
    int b=sc.nextInt();
    int x=m*b;
    int y=b;
    int area=0;
    int a=0,c=0;
    int count1=0;
    for(int i=1;i<=x;i++){
        int l=(int)((float)b-(float)((float)i/(float)m));

        if((i*l)>=area){
        area=i*l;
        a=i;
        c=l;
        int count=0;
        for(int d=0;d<=a;d++){
    for(int f=0;f<=c;f++){
    count=count+(d+f);
    }
    }

        if(count>count1)
            count1=count;
        }

    }
    if(area==0){
    if(x>y){
    area=x;
    a=x;}
    else{area=y;
    a=y;}
    for(int i=0;i<a;i++)
        count1=count1+i;
    }

    System.out.println(count1);
    }
}

import java.util.Scanner;

/**
 * Created by ssaadedin on 7/16/17.
 */
public class OkabeProblemB {

    static class Node {
        int x, y;

        public Node(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        @Override
        public String toString() {
            return "Node{" +
                    "x=" + x +
                    ", y=" + y +
                    '}';
        }
    }

    private static Scanner scanner;
    private  static int m, b;

    public static void main(String[] args) {
        scanner = new Scanner(System.in);

        m = scanner.nextInt();
        b = scanner.nextInt();

        long y = Integer.MAX_VALUE;
        long maxSum = 0;
        long testSum = 0;
        long x = findX(0) / 2;

        int c = 10;
        while (c <= 0) {
            y = findY(x);

            if (y < 0 ) {
                break;
            }

            testSum =( (x * (x + 1) / 2 ) * (y + 1)) + ( (y * (y + 1) / 2 ) * (x +1));

            if (testSum > maxSum) {
                maxSum = testSum;

            }
            x++;

c++;
        }

        System.out.println(maxSum);

    }

    public static int findY(double x){
        return (int)Math.floor( (x/ -m) + b);
    }

    public static int findX(int y) {
        return  (b - y) *m;
    }

    public static boolean isInLine(int x, int y) {
        return y + (x / m) - b == 0;

    }
}

import java.io.*;
import java.util.*;

public class Main {
	static int m, b;
	static int x, y;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		m = Integer.parseInt(st.nextToken());
		b = Integer.parseInt(st.nextToken());

		x = m * b;
		y = b;
		int h = y;
		int Answer=0;
		int w = x/2;
		if(w%m!=0)
			w++;
		h = -w / m + b;
		int col=0, row=0;
		for(int i=0;i<=w;i++)
			col+=i;
		col=(h+1)*col;
		for(int i=0;i<=h;i++)
			row+=i;
		row=(w+1)*row;
		int sum=col+row;
		Answer=Math.max(Answer,  sum);

		System.out.println(Answer);
	}
}

import java.util.Scanner;

public class Banana {

	 public static int banana (  )
	    {
		 Scanner s = new Scanner(System.in);
			int m = s.nextInt();
			int b = s.nextInt();
	    	// y = -x/m + b
	    	int y0=0, yf=0, banana1=0;
	    	float X, area=0, xf=0;
	    	//y = -x/m + b;
	    	y0 = b;
	    	//x0 = b*m;

	    	for( int Y=y0-1; Y>=0; Y-- )
	    	{
	    		X = b*m - Y*m;
	    		if( (X*10) % 10 == 0.0 )
	    		{
	    			if( X*Y >= area )
	    			{
	    				area = X * Y;
	    				xf = X;
	    				yf = Y;
	    			}
	    		}

	    	}

	    	for( int i=0; i<=yf; i++ )
	    	{
	    		for( int j=0; j<=xf; j++ )
	    		{
	    			banana1 += i + j;
	    			//System.out.println(banana1);
	    		}
	    	}
	    	return banana1;
	    }

	 public static void main(String[] args) {

			System.out.println( banana() );

		}

}

import java.util.*;
import java.io.*;

public class eighttwooneb {
  public static void main(String[] args) throws IOException {
    Scanner in = new Scanner(System.in);
    int m=in.nextInt();
    int b=in.nextInt();
    //triangle interior has inequality my+x<=b
    long max=0;
    int y;
    for (int x=b; x>=0; x--){
      y=(b-x)/m;
      max=Math.max(BANANAS(x,y),max);
    }
    System.out.println(max);
  }
  public static long BANANAS(int width, int height){
    return (long)(width+1)*(height+1)*(width+height)/2;
  }
}

import java.util.Scanner;

/**
 * Created by ssaadedin on 7/16/17.
 */
public class OkabeProblemB {

    static class Node {
        int x, y;

        public Node(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        @Override
        public String toString() {
            return "Node{" +
                    "x=" + x +
                    ", y=" + y +
                    '}';
        }
    }

    private static Scanner scanner;
    private  static int m, b;

    public static void main(String[] args) {
        scanner = new Scanner(System.in);

        m = scanner.nextInt();
        b = scanner.nextInt();

        int y = Integer.MAX_VALUE;
        int maxSum = 0;
        int testSum = 0;
        int x = 0;

        while (true) {
            y = findY(x);

            if (y == 0 ) {
                break;
            }
            for (int i = 0 ; i < x+1; i++) {

                for (int j = 0; j < y+ 1; j++) {
                    testSum += i +j;
                }
            }

            if (testSum > maxSum) {
                maxSum = testSum;

            }
            testSum = 0;
            x++;

        }

        System.out.println(maxSum);

    }

    public static int findY(double x){
        return (int)Math.floor( (x/ -m) + b);
    }

    public static int findX(int y) {
        return  (b - y) *m;
    }

    public static boolean isInLine(int x, int y) {
        return y + (x / m) - b == 0;

    }
}

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);

		double m = in.nextDouble();
		double b = in.nextDouble();
		double max = 0.0;

		for (double i=0.0;i<=m*b;i=i+1.0){
			double x = i;
			double y = Math.floor(b-x/m);
			double temp = (x+1.0)*(y+1.0)*(x+y)/2.0;
			if (temp>max){
				max=temp;
			}
		}
		System.out.printf("%.0f" , max);
	}

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int m=in.nextInt();
        int b=in.nextInt();
        int x,y;
        y=b;
        x=m*b;
        int max=0;
       for(int i=y-1;i>0;i--){
           x=m*(b-i);
           int tmp=0;
           for(int k=0;k<=i;++k){
               for(int l=0;l<=x;++l){
                   tmp=tmp+k+l;
               }
           }
           if(max<tmp)
               max=tmp;
       }
        System.out.println(max);
    }
}

import java.util.Scanner;

public class MainB {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int m = in.nextInt();
		int b = in.nextInt();
		in.nextLine();
		long max = 0;
		for(int y=0; y<=b; y++) {
			long first = (long)m*(b-y)*(m*(b-y) + 1)/2;
			long total = (long)first * (y+1) + y*(y+1)*(m*(b-y) + 1)/2;
			//System.out.println(y + " " + first + " " + total);
			if(max < total)
				max = total;
			else
				break;
		}
		System.out.println(max);
		in.close();
	}
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;

public class CF420 {

	static PrintWriter pw = new PrintWriter(System.out);

//	public static void main(String[] args) throws IOException {
//		Scanner sc = new Scanner(System.in);
//		int n = sc.nextInt();
//		Stack<Integer> st= new Stack<>();
//		int top = 1;
//		boolean ord = false;
//		int count = 0;
//		for(int i=0; i<2*n; i++){
//			String s = sc.next();
//			if(s.equals("add"))
//				{
//				st.push(sc.nextInt());
//				ord = false;
//				}
//			else
//				if(!ord&&st.peek()>top)
//				{
//					count++;
//					top++;
//					ord = true;
//				}else
//					top++;
//		}
//		System.out.println(count);
//	}
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int b = sc.nextInt();
		long max = 0;
		for (int i = 0; i <= b * m; i++) {
			double y = -((double) i) / m + b;
			if ((int) y == y) {
				long trees = (long) ((1l * i * (i + 1) / 2) * (y + 1) + (1l * y * (y + 1) / 2) * (i + 1));
				max = Math.max(trees, max);
			}
		}
		System.out.println(max);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String f) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(f));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] nextIntArray1(int n) throws IOException {
			int[] a = new int[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] shuffle(int[] a, int n) {
			int[] b = new int[n];
			for (int i = 0; i < n; i++)
				b[i] = a[i];
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				int t = b[i];
				b[i] = b[j];
				b[j] = t;
			}
			return b;
		}

		public int[] nextIntArraySorted(int n) throws IOException {
			int[] a = nextIntArray(n);
			a = shuffle(a, n);
			Arrays.sort(a);
			return a;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArray1(int n) throws IOException {
			long[] a = new long[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] newLongArrayC1(int n) throws IOException {
			long[] a = new long[n + 1];
			for (int i = 1; i <= n; i++) {
				a[i] = a[i - 1] + nextLong();
			}
			return a;
		}

		public long[] nextLongArraySorted(int n) throws IOException {
			long[] a = nextLongArray(n);
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				long t = a[i];
				a[i] = a[j];
				a[j] = t;
			}
			Arrays.sort(a);
			return a;
		}
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Codef {

    public static void main(String[] args) {
     FastReader read = new FastReader () ;
     int m = read.nextInt();
     int b = read.nextInt();

     long ans = 0 , max  = 0 ;
     int y = b ;
     int x = m * ( b - y ) ;

     while(y >= 0 ){
         ans = (x+1) * (y+1) * (x+y) / 2;
         max = Math.max(max, ans);
         y-- ;
         x = m * (b - y) ;
     }
        System.out.println(max);

}}
class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }}

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Q2CC {

	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		int m=s.nextInt(),b=s.nextInt();
		long x=m*b;
		long y=b;
		Long mx=Long.MIN_VALUE;
		for(long i=x;i>=0;i--){
			double w=(double)i/m;
			w*=(-1.0);
			w+=(double)b;
			long j=(long)Math.floor(w);
			if(mx<j*(i+1)+(i*(i+1)*(j+1))/2){
				mx=(j*(j+1)*(i+1)/2+(i*(i+1)*(j+1))/2);
				//System.out.println(i+" "+j);
			}
		}
		System.out.println(mx);
	}

	/*public static Map<Integer,ArrayList<Integer>> row=new HashMap<Integer,ArrayList<Integer>>();
	public static Map<Integer,ArrayList<Integer>> col=new HashMap<Integer,ArrayList<Integer>>();
	public static boolean doable(int num,int a,int b){
		for(int i=0;i<row.get(a).size();i++){
			if(col.get(b).contains(num-row.get(a).get(i))){
				return true;
			}
		}
		return false;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int[][] m=new int[n][n];
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				m[i][j]=s.nextInt();
			}
		}

		for(int i=0;i<n;i++){
			ArrayList<Integer> a=new ArrayList<Integer>();
			ArrayList<Integer> b=new ArrayList<Integer>();
			for(int j=0;j<n;j++){
				a.add(m[i][j]);
				b.add(m[j][i]);
			}
			row.put(i,a);
			col.put(i,b);
		}
		boolean f=true;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(m[i][j]!=1){
					if(!doable(m[i][j],i,j)){
						f=false;
						break;
					}
				}
			}
			if(!f){
				break;
			}
		}
		if(f){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}*/
		/*int t=s.nextInt();
		while(t-->0){
			int n=s.nextInt();
			int[] c=new int[n],w=new int[n];
			for(int i=0;i<n;i++){
				c[i]=s.nextInt();
			}
			for(int i=0;i<n;i++){
				w[i]=s.nextInt();
			}
			//int[] ans=new int[n];
			//HashMap<Integer,Integer> m=new HashMap<Integer,Integer>();
			int mx=-1;
			for(int i=0;i<n;i++){
				int sum=w[i];
				ArrayList<Integer> m=new ArrayList<Integer>();
				m.add(c[i]);
				for(int j=i+1;j<n;j++){
					if(m.contains(c[j])){
						break;
					}
					else{
						sum+=w[j];
						m.add(c[j]);
					}
				}
				if(mx<sum){
					mx=sum;
				}
			}
			System.out.println(mx);
		}*/
	//}

}

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Q2CC {

	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		int m=s.nextInt(),b=s.nextInt();
		int x=m*b;
		int y=b;
		int mx=-1;
		for(int i=x;i>=0;i--){
			double w=(double)i/m;
			w*=(-1.0);
			w+=(double)b;
			int j=(int)Math.floor(w);
			if(mx<j*(i+1)+(i*(i+1)*(j+1))/2){
				mx=j*(j+1)*(i+1)/2+(i*(i+1)*(j+1))/2;
				//System.out.println(i+" "+j);
			}
		}
		System.out.println(mx);
	}

	/*public static Map<Integer,ArrayList<Integer>> row=new HashMap<Integer,ArrayList<Integer>>();
	public static Map<Integer,ArrayList<Integer>> col=new HashMap<Integer,ArrayList<Integer>>();
	public static boolean doable(int num,int a,int b){
		for(int i=0;i<row.get(a).size();i++){
			if(col.get(b).contains(num-row.get(a).get(i))){
				return true;
			}
		}
		return false;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int[][] m=new int[n][n];
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				m[i][j]=s.nextInt();
			}
		}

		for(int i=0;i<n;i++){
			ArrayList<Integer> a=new ArrayList<Integer>();
			ArrayList<Integer> b=new ArrayList<Integer>();
			for(int j=0;j<n;j++){
				a.add(m[i][j]);
				b.add(m[j][i]);
			}
			row.put(i,a);
			col.put(i,b);
		}
		boolean f=true;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(m[i][j]!=1){
					if(!doable(m[i][j],i,j)){
						f=false;
						break;
					}
				}
			}
			if(!f){
				break;
			}
		}
		if(f){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}*/
		/*int t=s.nextInt();
		while(t-->0){
			int n=s.nextInt();
			int[] c=new int[n],w=new int[n];
			for(int i=0;i<n;i++){
				c[i]=s.nextInt();
			}
			for(int i=0;i<n;i++){
				w[i]=s.nextInt();
			}
			//int[] ans=new int[n];
			//HashMap<Integer,Integer> m=new HashMap<Integer,Integer>();
			int mx=-1;
			for(int i=0;i<n;i++){
				int sum=w[i];
				ArrayList<Integer> m=new ArrayList<Integer>();
				m.add(c[i]);
				for(int j=i+1;j<n;j++){
					if(m.contains(c[j])){
						break;
					}
					else{
						sum+=w[j];
						m.add(c[j]);
					}
				}
				if(mx<sum){
					mx=sum;
				}
			}
			System.out.println(mx);
		}*/
	//}

}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class _c5 {

    public static void main(String args[]){

        PrintWriter out = new PrintWriter(System.out);
        Reader in = new Reader();

        long m = in.nextInt();
        long b = in.nextInt();

        long max = 0;

        for(int x=0;x<=m*b;x++){
            if(x%m == 0){
                long y = -x/m + b;
                long h = x + 1;
                long v = y + 1;
                long hs = (x*(x+1))/2;
                long vs = (y*(y+1))/2;
                max = Math.max(max,hs*v+vs*h);
            }
        }

        out.println(max);
        out.flush();
        out.close();
    }
    static class Reader {

        private InputStream mIs;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public Reader() {
            this(System.in);
        }

        public Reader(InputStream is) {
            mIs = is;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();

            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = mIs.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

    }

}

//pakage joney_000[let_me_start]
//
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
/*
 * Author    : joney_000[let_me_start]
 * Algorithm : N/A
 * Platform  : N/A
 *
 */

/*    The Main Class                */
public class A
{
  private InputStream inputStream ;
  private OutputStream outputStream ;
  private FastReader in ;
  private PrintWriter out ;
  /*
    Overhead [Additional Temporary Strorage] but provides memory reusibility for multiple test cases.
    Size Limit : 10^5 + 4
  */
  private final int BUFFER = 5;
  private int    tempints[] = new int[BUFFER];
  private long   templongs[] = new long[BUFFER];
  private double tempdoubles[] = new double[BUFFER];
  private char   tempchars[] = new char[BUFFER];
  private final long mod = 1000000000+7;
  private final int  INF  = Integer.MAX_VALUE / 10;
  private final long INF_L  = Long.MAX_VALUE / 10;

  public A(){}
  public A(boolean stdIO)throws FileNotFoundException{
    // stdIO = false;
    if(stdIO){
      inputStream = System.in;
      outputStream = System.out;
    }else{
      inputStream = new FileInputStream("output.txt");
      outputStream = new FileOutputStream("output1.txt");
    }
    in = new FastReader(inputStream);
    out = new PrintWriter(outputStream);

  }

  void run()throws Exception{
    long m = i(); long b = i();
    // x + my = b*m
    // my <= b*m - x
    long max = 0;
    for(long x = 0; x <= 100000; x++){
      //for(long y = 0; y <= 100000; y++){
        long  my = b * m - x;
        long y = my/m;
        if(my >= 0 && y >= 0){
          max = Math.max(max, get(x, y));
        }
    }
    out.write(""+max+"\n");
  }// end run
long get(long i, long j){
  long sigx = i * (i + 1);
  long sigy = j * (j + 1);
  sigy /= 2;
  sigx /= 2;
  long res = sigx + sigy + i * sigy + j * sigx;
  return res;
}
void clear(int n){

}
//****************************** My Utilities ***********************//

void print_r(Object... o){
  out.write("\n"+Arrays.deepToString(o)+"\n");
  out.flush();
}

boolean isPrime(long n){
  if(n==1)return false;
  if(n<=3)return true;
  if(n%2==0)return false;
  for(int i=2 ;i <= Math.sqrt(n); i++){
    if(n%i==0)return false;
  }
  return true;
}
  // sieve
  int[] primes(int n){       // for(int i=1;i<=arr.length-1;i++)out.write(""+arr[i]+" ");
  boolean arr[] = new boolean[n+1];
  Arrays.fill(arr,true);
  arr[1]=false;
  for(int i=2;i<=Math.sqrt(n);i++){
    if(!arr[i])continue;
    for(int j = 2*i ;j<=n;j+=i){
      arr[j]=false;
    }
  }
  LinkedList<Integer> ll = new LinkedList<Integer>();
  for(int i=1;i<=n;i++){
    if(arr[i])ll.add(i);
  }
  n = ll.size();

  int primes[] = new int[n+1];
  for(int i=1;i<=n;i++){
    primes[i]=ll.removeFirst();
  }
  return primes;
}
long gcd(long a , long b){
  if(b==0)return a;
  return gcd(b , a%b);
}
long lcm(long a , long b){
  if(a==0||b==0)return 0;
  return (a*b)/gcd(a,b);
}
long mulmod(long a , long b ,long mod){
  if(a==0||b==0)return 0;
  if(b==1)return a;
  long ans = mulmod(a,b/2,mod);
  ans = (ans*2)% mod;
  if(b%2==1)ans = (a + ans)% mod;
  return ans;
}
long pow(long a , long b ,long mod){
  if(b==0)return 1;
  if(b==1)return a;
  long ans = pow(a,b/2,mod);
  ans = (ans * ans);
  if(ans >= mod )ans %= mod;

  if(b%2==1)ans = (a * ans);
  if(ans >= mod )ans %= mod;

  return ans;
}
  // 20*20   nCr Pascal Table
long[][] ncrTable(){
  long ncr[][] = new long[21][21];
  for(int i=0 ;i<=20 ;i++){ncr[i][0]=1;ncr[i][i]=1;}
    for(int j=0;j<=20 ;j++){
      for(int i=j+1;i<= 20 ;i++){
        ncr[i][j] = ncr[i-1][j]+ncr[i-1][j-1];
      }
    }
    return ncr;
  }
  //*******************************I/O******************************//
  int i()throws Exception{
    //return Integer.parseInt(br.readLine().trim());
    return in.nextInt();
  }
  int[] is(int n)throws Exception{
  //int arr[] = new int[n+1];
    for(int i=1 ; i <= n ;i++)tempints[i] = in.nextInt();
      return tempints;
  }
  long l()throws Exception{
    return in.nextLong();
  }
  long[] ls(int n)throws Exception{
    for(int i=1 ; i <= n ;i++)templongs[i] = in.nextLong();
      return templongs;
  }

  double d()throws Exception{
    return in.nextDouble();
  }
  double[] ds(int n)throws Exception{
    for(int i=1 ; i <= n ;i++)tempdoubles[i] = in.nextDouble();
      return tempdoubles;
  }
  char c()throws Exception{
    return in.nextCharacter();
  }
  char[] cs(int n)throws Exception{
    for(int i=1 ; i <= n ;i++)tempchars[i] = in.nextCharacter();
      return tempchars;
  }
  String s()throws Exception{
    return in.nextLine();
  }
  BigInteger bi()throws Exception{
    return in.nextBigInteger();
  }
//***********************I/O ENDS ***********************//
//*********************** 0.3%f [precision]***********************//
/* roundoff upto 2 digits
   double roundOff = Math.round(a * 100.0) / 100.0;
                    or
   System.out.printf("%.2f", val);

*/
/*
  print upto 2 digits after decimal
  val = ((long)(val * 100.0))/100.0;

*/

    private void closeResources(){
     out.flush();
     out.close();
     return;
    }
    public static void main(String[] args) throws java.lang.Exception{
    //let_me_start Shinch Returns

    /*
        // Old Reader Writer
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
    BufferedReader br=new BufferedReader(new FileReader("input.txt"));
        BufferedWriter out=new BufferedWriter(new FileWriter("output.txt"));
    */
        A driver = new A(true);

        driver.run();

        driver.closeResources();
        return ;

      }

    }

    class FastReader{

      private boolean finished = false;

      private InputStream stream;
      private byte[] buf = new byte[4 * 1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;

      public FastReader(InputStream stream){
        this.stream = stream;
      }

      public int read(){
        if (numChars == -1){
          throw new InputMismatchException ();
        }
        if (curChar >= numChars){
          curChar = 0;
          try{
            numChars = stream.read (buf);
          } catch (IOException e){
            throw new InputMismatchException ();
          }
          if (numChars <= 0){
            return -1;
          }
        }
        return buf[curChar++];
      }

      public int peek(){
        if (numChars == -1){
          return -1;
        }
        if (curChar >= numChars){
          curChar = 0;
          try{
            numChars = stream.read (buf);
          } catch (IOException e){
            return -1;
          }
          if (numChars <= 0){
            return -1;
          }
        }
        return buf[curChar];
      }

      public int nextInt(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        int sgn = 1;
        if (c == '-'){
          sgn = -1;
          c = read ();
        }
        int res = 0;
        do{
          if(c==','){
            c = read();
          }
          if (c < '0' || c > '9'){
            throw new InputMismatchException ();
          }
          res *= 10;
          res += c - '0';
          c = read ();
        } while (!isSpaceChar (c));
        return res * sgn;
      }

      public long nextLong(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        int sgn = 1;
        if (c == '-'){
          sgn = -1;
          c = read ();
        }
        long res = 0;
        do{
          if (c < '0' || c > '9'){
            throw new InputMismatchException ();
          }
          res *= 10;
          res += c - '0';
          c = read ();
        } while (!isSpaceChar (c));
        return res * sgn;
      }

      public String nextString(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        StringBuilder res = new StringBuilder ();
        do{
          res.appendCodePoint (c);
          c = read ();
        } while (!isSpaceChar (c));
        return res.toString ();
      }

      public boolean isSpaceChar(int c){
        if (filter != null){
          return filter.isSpaceChar (c);
        }
        return isWhitespace (c);
      }

      public static boolean isWhitespace(int c){
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }

      private String readLine0(){
        StringBuilder buf = new StringBuilder ();
        int c = read ();
        while (c != '\n' && c != -1){
          if (c != '\r'){
            buf.appendCodePoint (c);
          }
          c = read ();
        }
        return buf.toString ();
      }

      public String nextLine(){
        String s = readLine0 ();
        while (s.trim ().length () == 0)
          s = readLine0 ();
        return s;
      }

      public String nextLine(boolean ignoreEmptyLines){
        if (ignoreEmptyLines){
          return nextLine ();
        }else{
          return readLine0 ();
        }
      }

      public BigInteger nextBigInteger(){
        try{
          return new BigInteger (nextString ());
        } catch (NumberFormatException e){
          throw new InputMismatchException ();
        }
      }

      public char nextCharacter(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        return (char) c;
      }

      public double nextDouble(){
        int c = read ();
        while (isSpaceChar (c))
          c = read ();
        int sgn = 1;
        if (c == '-'){
          sgn = -1;
          c = read ();
        }
        double res = 0;
        while (!isSpaceChar (c) && c != '.'){
          if (c == 'e' || c == 'E'){
            return res * Math.pow (10, nextInt ());
          }
          if (c < '0' || c > '9'){
            throw new InputMismatchException ();
          }
          res *= 10;
          res += c - '0';
          c = read ();
        }
        if (c == '.'){
          c = read ();
          double m = 1;
          while (!isSpaceChar (c)){
            if (c == 'e' || c == 'E'){
              return res * Math.pow (10, nextInt ());
            }
            if (c < '0' || c > '9'){
              throw new InputMismatchException ();
            }
            m /= 10;
            res += (c - '0') * m;
            c = read ();
          }
        }
        return res * sgn;
      }

      public boolean isExhausted(){
        int value;
        while (isSpaceChar (value = peek ()) && value != -1)
          read ();
        return value == -1;
      }

      public String next(){
        return nextString ();
      }

      public SpaceCharFilter getFilter(){
        return filter;
      }

      public void setFilter(SpaceCharFilter filter){
        this.filter = filter;
      }

      public interface SpaceCharFilter{
        public boolean isSpaceChar(int ch);
      }
    }
    /******************** Pair class ***********************/

  class Pair implements Comparable<Pair>{
     public int a;
     public int b;
          public int c;
     public Pair(){
      this.a = 0;
      this.b = 0;
    }
    public Pair(int a,int b, int c){
      this.a = a;
      this.b = b;
      this.c = c;
    }
    public int compareTo(Pair p){
      if(this.a==p.a){
       return this.b-p.b;
     }
     return p.a-this.a;
   }
   public String toString(){
    return "a="+this.a+" b="+this.b;
  }

}

import java.util.*;
import java.io.*;
import java.math.*;
public final class Solution
{
	static int mod1 = (int)Math.pow(10, 9) + 7;
	static BigInteger mod = new BigInteger(mod1 + "");
    public static void main(String[] args)
    {
    	 Reader input = new Reader();
         PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
         int m = input.nextInt(), b = input.nextInt();
         int xIntersection = b * m , yIntersection = b ;
         double x ;
         long result = 0;
         for(int i = yIntersection ; i >= 0 ; i--)
         {
        	 x = (b - i) * m;
        	 if(Math.abs(x - (int)x) <= 0.0001)
        	 {
        		 if((int)x + i > result)
        			 result = (int)x + i;
        	 }
         }
         int sumX = 0;
         for(int i = 1 ; i <= xIntersection ; i++)
         {
        	 sumX += i;
        	 int y = b - (i / m);
        	 if(Math.abs(y - ((double)b - (i / (double)m))) > 0.0001)
        		 continue;
        	 int bananas = sumX * (y+1) + (y+1) * y / 2 * (i+1);
        	 if(bananas > result)
        		 result = bananas;
         }
         int sumY = 0;
         for(int i = 1 ; i <= yIntersection ; i++)
         {
        	 sumY += i;
        	 int x1 = (b - i) * m;
        	 int bananas = sumY * (x1+1) + (x1+1) * x1 / 2 * (i+1);
        	 if(bananas > result)
        		 result = bananas;
         }
         out.println(result);
         out.close();
    }
    public static class Reader
    {
    	BufferedReader br;
    	StringTokenizer st;
    	public Reader()
    	{
    		br = new BufferedReader(new InputStreamReader(System.in));
    	}
    	public String next()
    	{
    		try
    		{
        		if(st == null || !st.hasMoreTokens())
        			st = new StringTokenizer(br.readLine());
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return st.nextToken();
    	}
    	public int nextInt()
    	{
    		return Integer.parseInt(next());
    	}
    	public double nextDouble()
    	{
    		return Double.parseDouble(next());
    	}
    	public long nextLong()
    	{
    		return Long.parseLong(next());
    	}
    	public String nextLine()
    	{
    		try
    		{
    			return br.readLine();
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return "";
    	}
    }
}