Marble slide

A ball rolls down alternating left and right fins, and we must find the largest diameter for which it still slides all the way to the bottom instead of getting wedged.

Hard8GeometryBinary searchSimulationMathNo attempts yetTime limit2sMemory limit512 MB

Problem

A factory wants to build the toy slide in the figure below. Two wooden rods stand upright, and fins attached to the rods in turn span the space between them. A steel ball placed on the highest fin slides down the fins one after another under gravity and finally leaves the toy.

The owner of the factory already fixed the design, which gives the size, the position and the slope of the rods and of every fin, and thousands of units are being made. The factory manager has to buy the steel balls. Before ordering thousands of them, the manager wants to know the largest ball diameter that still reaches the bottom instead of stopping in the middle.


Figure 1: two examples. In (a) the ball reaches the end. In (b) the ball stops in the middle and never reaches the end.

Seen from the front, the toy is flat. The left rod is the line x=0x = 0, the right rod is the line x=Lx = L, and every fin is a segment with no thickness. The ball is a circle. It may touch the rods and the fins, but it may not pass through them. Write a program that reads the design of the toy and computes the largest diameter of a ball that leaves the toy instead of stopping in the middle.

Input

The input holds several test cases. Read until the end of the file.

The first line of a test case has one integer NN, the number of fins. The second line has two integers LL and HH, the distance between the rods and the height of the rods. The left rod stands at coordinate 00 of the XX axis and the right rod stands at coordinate LL.

Each of the next NN lines describes one fin, from the highest fin to the lowest one. The rod a fin is attached to alternates from line to line. The highest fin (the first one described) has its end attached to the left rod, and the second highest fin has its end attached to the right rod. Odd numbered fins are attached to the left rod and even numbered fins are attached to the right rod.

Each fin is given by three integers YiY_i, XfX_f and YfY_f separated by a blank space. (Xf,Yf)(X_f, Y_f) is the coordinate of the far end of the fin. An odd numbered fin starts at (0,Yi)(0, Y_i) and an even numbered fin starts at (L,Yi)(L, Y_i).

Every fin has Yi>YfY_i > Y_f, so it goes down from its start to its far end, and the length of a fin is smaller than the width of the toy. Two consecutive fins AA and BB satisfy YfAYiBY_{fA} \ge Y_{iB}, so the far end of AA is at the same height as the start of BB or higher. Two consecutive fins also overlap horizontally, so a ball that leaves the far end of AA always lands on BB.

The fins are so thin that their thickness can be ignored, and a fin is always wider than the diameter of the ball, so the ball always has room at the side to slide along a fin.

Restrictions

  • 1N1031 \le N \le 10^3
  • 1L1031 \le L \le 10^3
  • 1H1031 \le H \le 10^3
  • 0<Xf<L0 < X_f < L
  • 0YiH0 \le Y_i \le H, 0YfH0 \le Y_f \le H, Yi>YfY_i > Y_f

Output

For each test case print one line with a single number, the largest diameter of a ball that travels through the whole toy, rounded to two decimal places.