has been cornered!
With his Art Academy in ashes, his artworks missing, his friends all having left him, and his entire life in shambles, he has constructed a massive army with all of his forces in a last stand. The structure of his army is composed of line segments. Somewhere in the area, he has also hidden himself away in a secret bunker, at coordinates .
Knowing this information,
has ordered her subject, , to destroy the bunker and end the terror, once and for all. Since calculating curved trajectory is hard, he will send his missiles only in straight lines, starting from the x-axis, firing directly towards the bunker. However, being a merciful person, he will try to avoid hitting 's army at all costs, as they are not all as evil as him.Weighing his options,
would like to ask you a question:What is the total length of the range that , where the bunker is at ?
can fire from in order to hit 's bunker without hitting his army, if he can only fire starting from the x-axis, in the range
It is guaranteed that the y-position of his bunker will be strictly greater than the entirety of his army. In other words, his army will always be between the x-axis and his bunker.
Input Specification
On the first line, there is a single integer , representing the number of lines in 's army. .
The second line will contain four space-separated integers, , , and . , , .
The next lines will contain four space-separated integers, , , , , meaning that there is a line segment from the point to the point . , , representing a part of the army. It is guaranteed that these two points will be distinct.
Output Specification
Output the total length of the range which
can fire from in order to hit 's bunker without hitting his army.Your answer will be considered correct if the absolute difference from the official answer is at most .
Constraints
Subtask 1 [30%]
Subtask 2 [70%]
No additional constraints.
Sample Input
1
1 10 3 3
1 2 3 1
Sample Output
7.000
Explanation
The green region represents the area which can be fired from. However, since you can only fire from the x-axis, in the range as specified by the input, the only valid range is from , which has a length of .
Comments