Cake Cutting#2049

Cake Cutting

2 seconds
64 megabytes
Very hard

There is a very large rectangular cake on the -plane, whose four corners are , , , and .

Each time you are hungry, you cut off a piece from the cake and eat it. Your task is to output the area of the remaining cake after each cut.

Input

There are several test cases. The first line contains three integers , , (1 \le n \le 200\,000, 1 \le w, h \le 1000), representing the number of cuts, and the width and height of the cake. Each of the following lines contains four positive real numbers x_1, y_1, x_2, y_2, not greater than . This means you cut the cake along the straight line connecting (x_1, y_1) and (x_2, y_2), and eat the part on the right (if any), looking from (x_1, y_1) to (x_2, y_2). Input is terminated by end-of-file (EOF). The size of the input file does not exceed MB.

Output

For each cut, output the area of the cake after the cut, to at least three digits after the decimal point. An absolute error of 10^{-3} for each value you output is allowed.

Examples

Example 1

Loading
Loading