Alice, Bob and Charlie, team ABC have come to the venue of world finals to be inspired by the world finalists.
For the entertainment purpose of the contestants and the visitors, some game segments have been set up. One such game has taken the full attention of the team because of the prize. The prize is that the participant will get chocolates if he manages to score points in the game and all the members of team ABC love chocolates.
The game is very simple. You have to throw a ball not more than once.
Well, there are some more details.
There will be blocks numbered from to and their lengths are unit. You will have to stand before the first block and throw the ball on a block whose number is at most .
You will get points if the ball lands on block . When the ball is thrown, you can make it bounce and land in multiple blocks to gain more points. Initially you have . It’s possible that the ball can move out of the play area but as there aren’t any blocks there no more scores would be added.
To make the ball bounce, you have to throw the ball with a certain power level. With each bounce, the ball will lose power, thus will move unit less than the previous bounce.
So, let’s say you are playing the game where and you have thrown the ball with power on the block as it’s number is less than .
First drop will be on the block with power .
After bouncing on block, power = , score = , next block =
After bouncing on block, power = , score = , next block =
After bouncing on block, power = , score = , next block =
After bouncing on block, power = , score = , next block = having no power, none.
This is just an example. There might be a more optimal solution.
Now, you are not playing the game. But you can see Team ABC’s interesting approach to gain the maximum amount of points. Alice is thinking of a clever solution to gain the most points. Bob on the other hand, started to calculate all possible outcomes for all possible actions to find the most winning strategy, But Charlie has thrown the ball and won the maximum amount of points and the maximum number of chocolates one can get from that game. The announcer specially announced this incident but didn’t disclose how many points Charlie acquired. As Charlie and the team have already won a huge amount of chocolates, they stopped investing their time on this game and moved on to the next one.
You as an observant one, want to find out the exact points Charlie earned, as you also love chocolates. You already realized that having more power always won't do you any good, so you will never throw the ball with power more than .
Given and , you have to find out the maximum score(chocolates) one can get from the game.
The first and only line of input will contain 2 space separated integers and .
You have to output an integer which is the maximum number of chocolates you can gain from the game.
Input | Output |
---|---|
10 5 | 30 |
Throwing the ball on the block with power will yield the maximum score. |
Input | Output |
---|---|
28 5 | 126 |
Throwing the ball on the block with power will yield the maximum score. |