You command a powerful unit of siege tanks. Your troops have encountered the enemy and are preparing to attack. The enemy formation occupies positions numbered from to in a line. The initial health at position is . A position with health contains no enemy.
For each attack, a tank can use either of the following modes.
Health cannot become negative. Decreasing health by changes it to . You may attack a position whose health is already .
Find the minimum total cost required to make the health at every position equal to .
The input is given in the following format.
Print the minimum total cost required to make the health at every position equal to .
In the first example, attack position once in siege mode.
In the second example, attack position twice in siege mode, then attack position once in tank mode. The total cost is .
| 2 | 25 |
| 3 | 60 | No additional constraints. |
In the third example, attack position once in tank mode. A siege-mode attack would also make all health values , but would cost .
In the fourth example, attack position once in siege mode. There is no position to its left, so the damage to the left is ignored.