Dadas is preparing to propose to Woohyun. In the past, he just ended it with an "I like you," but now, he plans to show his true feelings by preparing many jewels with special care.
Dadas sets up pillars at integer coordinates from to on a number line and places jewels on them. The height of the pillar at coordinate is . If , the jewel is placed on the ground. Therefore, there is a total of jewels, and the position of each jewel is at coordinate with height .
Dadas wants to install lights so that all the jewels can be illuminated. Each light illuminates the area downwards within a -degree angle to the left and right from its installed position, including the boundaries. Shadows casted by the pillars are ignored.
The lights are installed at positive integer heights at integer coordinates from to on the number line. They can be installed regardless of the heights of the pillar and jewel at the corresponding coordinate. The installation cost of each light is equal to its height. The total installation cost of the lights is equal to the sum of the installation costs of each light.
The figure below is an example showing a state where the light does not reach some jewels. Such installation is not allowed.
On the other hand, the figure below is an example of a possible installation of lights where all jewels are illuminated by the lights.
Dadas gives commands times as follows.
x y: Change the value of to .\end{itemize} Find the minimum installation cost in the initial state. Then, print the minimum total installation cost of the lights after each of the given commands.
Input
The input is given in the following format.
Output
Print lines. Every line should contain one integer: -th line contains the minimum total installation cost of the lights after commands.
Constraints
- .
- .
- ().
- ().
- ().
Subtasks
Samples
In the initial state, the following figure shows the optimal installation of the lights, minimizing the total installation cost to .
The following figure shows the optimal installation of the lights right after the first query, minimizing the total installation cost to .