An Easy Problem?!

Time Limit
1s
Memory Limit
65536KB
Judge Program
Standard
Ratio(Solve/Submit)
0.00%(0/0)
Description:

It's raining outside. Farmer Johnson's bull Ben wants some rain to water his flowers. Ben nails two wooden boards on the wall of his barn. Shown in the pictures below, the two boards on the wall just look like two segments on the plane, as they have the same width.


Your mission is to calculate how much rain these two boards can collect.

Input:

The first line contains the number of test cases.
Each test case consists of 8 integers not exceeding 10,000 by absolute value, x1, y1, x2, y2, x3, y3, x4, y4. (x1, y1), (x2, y2) are the endpoints of one board, and (x3, y3), (x4, y4) are the endpoints of the other one.

Output:

For each test case output a single line containing a real number with precision up to two decimal places - the amount of rain collected.

Sample Input:
2
0 1 1 0
1 0 2 1

0 1 2 1
1 0 1 2
Sample Output:
1.00
0.00

Submit