CF821B.Okabe and Banana Trees

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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)(x,y) in the 2D plane such that xx and yy are integers and 0<=x,y0<=x,y . There is a tree in such a point, and it has x+yx+y bananas. There are no trees nor bananas in other points. Now, Okabe draws a line with equation . 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 101810^{18} . You can trust him.

输入格式

The first line of input contains two space-separated integers mm and bb ( 1<=m<=10001<=m<=1000 , 1<=b<=100001<=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
    

说明/提示

The graph above corresponds to sample test 1. The optimal rectangle is shown in red and has 3030 bananas.

首页