SP12371 TAP2012H - High Mountains

Description

\[The original version of this problem (in Spanish) can be found at \] To go on holidays, Horacio and Hernan have sacrificed their participation in an important programming contest. While you are in this contest, they are close to the Andes driving along Highway 40, in Argentina, enjoying a pleasant view of the mountains in the horizon. Right now the sky over the highway is a clear, uniform blue, while the visible part of the mountains is a profile presenting rich and attractive textures. This worries Horacio and Hernan, because they fear that the pictures they are taking will be very expensive to print correctly. For this reason, in the next stop they will take out their laptops and write a program to estimate the area of the mountain profile that has to be printed in each picture. Can you finish this program before them?

Input Format

Each test case is described using several lines. The first line contains a single integer number **N**, indicating the number of mountains (**1 ≤ N** **≤** **1000**). Each of the **N** following lines describes a mountain using three integer numbers **I**, **D** and **H**, representing respectively the **X** coordinate of the left endpoint of the base, the same for the right endpoint of the base, and the height of the mountain (**1** **≤** **I, D, H** **≤** **10 $ ^{5} $** with **I < D**). In each test case there are no two mountains that are exactly the same (that is, with equal values for the three parameters **I**, **D** and **H**). The end of the input is signalled by a line containing the number **-1**.

Output Format

For each test case, you should print a single line containing a rational number, representing the area of the corresponding mountain profile. Round the result to the closest rational with two decimal digits. In case of ties, round up. Note that you should always use exactly two digits after the decimal dot, even if this means ending with a zero.