National Olympiad in Informatics, China, 2004
Country M has a very wet climate, especially in city P. Frequent precipitation brings forth many troubles for its people. To make crossing the road easier on rainy days, the government has installed a device known as the "automatic umbrella" above every crosswalk in the city (depicted in figure 1).

Figure 1
Each automatic umbrella can be seen as a rectangle-shaped board of an irrelevant thickness. This type of umbrella is exceptional at absorbing water. Rainwater that lands on the umbrella will be completely sucked up by little holes on its upper surface and transported away using pipes. When it is not raining, these umbrellas are idle. Once it rains, they will immediately begin to move back and forth in a linear path with constant speed - that is, from one side of the road to the other side with uniform motion, then returning to the first side with the same speed, and so forth until the rain ends. At no given time will the umbrella move beyond the boundaries of the road. With these automatic umbrellas, pedestrians without an umbrella of their own will be able to walk underneath them during rainy days and avoid getting wet.
Due to the limited sizes of automatic umbrellas, one is clearly not enough when there are a lot of people trying to use them to cross the road. So, the government has installed multiple automatic umbrellas at various major intersections. Each umbrella's width is equal to the width of the crosswalk, however, their heights are all unique, and they may not necessarily share the same lengths or speeds.
Given the status of a particular crosswalk, please calculate the total
volume of water that has landed on the ground of the crosswalk,
Input Specification
The first line contains four integers
To better explain this, figure 2 depicts a side view of

Figure 2
In the following
Output Specification
The output should contain one line with one real number, representing
the total volume of water that has landed on the ground of the
crosswalk,
Constraints
- Raindrops will fall straight down, landing uniformly amongst the ground at a uniform rate.
- The surfaces of automatic umbrellas are parallel to the ground.
- The widths of automatic umbrellas and the crosswalk are the same, all equaling 1.
- The total number of back and forth cycles for all the umbrellas will not exceed
. Moving from one side to the other and back counts as one cycle.
Sample Input
2 4 3 10
0 1 1
3 1 -1
Sample Output
65.00
Problem translated to English by .
Comments