304306: CF821B. Okabe and Banana Trees

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Okabe and Banana Trees

题目描述

Okabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees. Consider the point $ (x,y) $ in the 2D plane such that $ x $ and $ y $ are integers and $ 0<=x,y $ . There is a tree in such a point, and it has $ x+y $ bananas. There are no trees nor bananas in other points. Now, Okabe draws a line with equation ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821B/943332af45ee9b24d3dd582c61cd6fb6bc9281c7.png). Okabe can select a single rectangle with axis aligned sides with all points on or under the line and cut all the trees in all points that are inside or on the border of this rectangle and take their bananas. Okabe's rectangle can be degenerate; that is, it can be a line segment or even a point. Help Okabe and find the maximum number of bananas he can get if he chooses the rectangle wisely. Okabe is sure that the answer does not exceed $ 10^{18} $ . You can trust him.

输入输出格式

输入格式


The first line of input contains two space-separated integers $ m $ and $ b $ ( $ 1<=m<=1000 $ , $ 1<=b<=10000 $ ).

输出格式


Print the maximum number of bananas Okabe can get from the trees he cuts.

输入输出样例

输入样例 #1

1 5

输出样例 #1

30

输入样例 #2

2 3

输出样例 #2

25

说明

![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821B/9062959c907537ca725899b162ca1dad63845c7e.png)The graph above corresponds to sample test 1. The optimal rectangle is shown in red and has $ 30 $ bananas.

Input

加入题单

上一题 下一题 算法标签: