There are N mountains represented by N Isosceles triangles above ground. We can assume that every adjacent mountain can shape a valley. When it rains, the rain will form a plane in the valley. Now let's make things a little easier by drawing the vertical profile of the actual mountains. You can get more details from the below figure.
When it rains, the quantity of water is proportional to the time that is raining and the length of the plane by which some valley can receive the water (in the figure 1, “l1” is the length of the plane). In the figure 1, v means the velocity of the rain (please see the figure for more details for the formula of the rain). If a valley is filled with rain, the water will overflow. According to the shape of the mountain, the water may flow to the left, or to the right. You can assume that the height of the different mountains are different. This outflow of water will fill the valley next to the current valley. You can get the more details from the Figure 2.
You will get the information of the mountain. Please output the time during which the mountains can be filled by the rain. After the time, the quantity of the water will not increase even if it still rains.