Welcome to ZOJ
 Contests Information Problems Runs Statistics Ranklist Clarification
68 - ZOJ Monthly, July 2008 - 1008
Tower

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Once upon a time, there was a temple. And the honor of the monks in the temple is their tower.One day, the Buddhist abbot wants to find out who is the smartest monk in the temple, so he gives the monks a problem: Calculate the area of the tower's shadow at a specific time of the day. Perhaps the mission is easy to complete with a directly measuring the shadow, but the Buddhist abbot makes it nearly impossible, he said:

"Leave the shadow alone! You can only measure the tower itself!"

Though all the monks are very smart, they still have no idea of this problem. So now it is your turn to solve it.

The tower is formed with N floors, each floor is a hexagon, and every two adjacent floors will be linked by six congruent isosceles trapezoid (For example, floor N links to floor N-1, floor 2 links to floor 1, floor 1 links to floor 0). The top of the tower, which can be regarded as floor 0, is a dot (that is, it can be treated as a hexagon with a zero side length). Then floor 1 is the floor under floor 0, floor 2 is under floor 1, floor 3 is under floor 2...floor N is under floor (N - 1). Now let Ri equals to the side length of hexagon number i, Hi equals to the height of floor i (of course it's the height from the bottom), and you know the shadow's length L of a exactly vertically placed stick (Its height exactly equals to 1. We assume that sun light is parallel light, and it is perpendicular to two parallel sides of each hexagon).
Now give you Ri, Hi and L, can you solve the problem?

Input

There are several test cases.
In each case, there will be two numbers in the first line, N(integer, 1 <= N <= 150) and L(fraction, L >= 0), which represent the number of floot and the shadow's length of the stick. The next N + 1 lines describe the side length Ri and height Hi(i starts from 0 to N), each line contains only two numbers, Ri and Hi(fractions, 0.00 <= Ri, Hi < 1000.00).We guarantee that Hi > Hj(0 <= i < j <= N), R0 = 0 and Hn = 0.

Output

For each test case, you may output a float number S, which represents the area of the tower's shadow. Round S to 4 digits after decimal point.

Sample Input

1 1.00
0.00 3.00
1.00 0.00

3 0.00
0.00 3.00
10.00 2.00
5.00 1.00
11.00 0.00

Sample Output

4.2990
314.3672

Author: FAN, Yuzhe

Submit    Status