Under construction

Still being built. Things may change

Attractions On Plane

Time limit2sMemory limit512 MB

Summary
Given N rectangles above the x-axis, find for each one the fraction of the segment from (0,0) to (X,0) during which it is the closest attraction.
Level

Hard8 of 10

Topics
Geometry, Divide and conquer
Solved
No attempts yet

Problem

You are going on a trip on the Cartesian plane. Starting at (0,0)(0, 0) and going to (X,0)(X, 0) at constant speed, you view attractions. Each attraction is a rectangle with its base at (xi,yi)(x_i, y_i), width wiw_i, and height hih_i. Attractions can overlap.

The distance from you to an attraction is the Euclidean distance from you to its closest point. The attraction with the minimum distance is the Star Attraction. If several attractions share the minimum distance, the one with the lower index is the Star Attraction (it has the better rating).

For each attraction, find the percentage of the trip during which it is the Star Attraction.

Input

The first line contains two integers NN and XX (1≤N≤2000001 \le N \le 200000, 1≤X≤10000001 \le X \le 1000000).

Each of the next NN lines contains four integers xix_i, yiy_i, wiw_i, and hih_i (1≤xi,yi≤10000001 \le x_i, y_i \le 1000000, 0≤wi,hi≤10000000 \le w_i, h_i \le 1000000).

Output

Output NN lines. On line ii, print the percentage of time that attraction ii is the Star Attraction. An answer is accepted if its absolute or relative error is at most 10−810^{-8}.

Examples2

  1. Example 1

    Input
    2 10
    1 2 5 1
    2 1 1 5
    
    Expected output
    52.679491924
    47.320508076
    
  2. Example 2

    Input
    4 7
    1 3 0 0
    3 4 0 0
    5 5 0 0
    3 4 0 0
    
    Expected output
    53.571428571
    35.714285714
    10.714285714
    0.000000000