Rays and Segments#4970

Rays and Segments

3 seconds
64 megabytes
Very hard

A new experiment is being conducted. At certain moments, rays are emitted from the origin with given velocity vectors, and at other moments, segments (barriers) are placed on the plane — these are non-degenerate line segments that do not pass through the origin. The segments may intersect. For the analysis of the experiment, you must determine how long each ray travels before hitting a segment, assuming each ray moves at a constant velocity. If a ray does not intersect any segment, it flies indefinitely.

Input

Each line of the input begins with either shot, wall, or end. The number of lines does not exceed . After shot, there follow two integers — the velocity vector components of the emitted ray (not both zero). After wall, there follow four integers — coordinates of the segment's endpoints. end denotes the end of input. All coordinates are integers with absolute values not exceeding . All events are given in chronological order, and the time intervals between events are greater than the time required to construct a segment or for a ray to reach the nearest segment or to exit the experimental area.

Output

For each emission (shot), output on a separate line the time that the ray will travel, with a precision of 10^{-6}. If the ray does not hit any segment, output Infinite instead of a number.

Examples

Example 1

Loading
Loading