Tree Lighting

No attempts yetTime limit1sMemory limit128 MB

Problem

Arbor Day is a big day for the Pine family of Chestnut Grove. Every year the family, led by their father Hickory, covers the front yard and the front of the house with hundreds of Arbor Day decorations. At night Hickory aims a yard light at the front of the house so that people walking by get a good look at the whole display.

Some decorations block the light and drop shadows on the front of the house. Others act like mirrors and send light back onto parts of the wall the direct beam never reaches. In one layout the light spreads out from a point low in the yard, a horizontal decoration in the middle swallows the middle of the beam, and a decoration on the right reflects part of it back, so about 75% of the front of the house ends up lit.

The decorations change from year to year, so Hickory wants one general method that takes a layout and reports how much of the front of his house will be lit.

Light and decorations follow these rules.

  • The light sits at the origin. It spreads in a wedge symmetric about the positive yy axis, opening ang/2\mathit{ang}/2 degrees on either side.
  • A ray dies once the total distance it has travelled passes len\mathit{len}. That total is the sum of the lengths of every leg between reflections.
  • Every decoration is a segment of zero thickness. A non-reflective decoration absorbs any ray that reaches it. A reflective decoration is mirrored on both sides and sends a ray back at the angle it arrived. Neither kind lets a ray pass through.
  • The front of the house is a horizontal segment above every decoration, and it stops any ray that reaches it.

Report what percentage of the length of the front of the house is reached by at least one ray.

Input

The input holds several test cases.

Each test case starts with a line holding an integer nn, a real number ang\mathit{ang} and a real number len\mathit{len}. nn is the number of decorations (0n100 \le n \le 10). ang\mathit{ang} is the spread of the light in degrees (0<ang1500 < \mathit{ang} \le 150). The light is always at the origin, and the beam is symmetric about the positive yy axis, opening ang/2\mathit{ang}/2 degrees on either side. len\mathit{len} is the greatest distance any one ray can travel. Past that distance the beam is too weak to add anything to the lighting of the house.

Each of the next nn lines holds five integers x1x_1 y1y_1 x2x_2 y2y_2 rr. The first four give the endpoints of a decoration. rr is 00 for a non-reflective decoration and 11 for a reflective one.

After those nn lines comes a single line with four integers x1x_1 yy x2x_2 yy giving the endpoints of the front of the house, with y>0y > 0.

No decoration meets another decoration, the front of the house, or the origin, and no decoration has a yy coordinate larger than the yy of the front of the house. Every coordinate is between 10000-10000 and 1000010000. In each test case the placement of the decorations and the value of len\mathit{len} keep the total number of reflections at 100100 or fewer.

A line holding 0 0.0 0.0 ends the input. It is not a test case.

Output

For each test case print one line in this form.

Case k: p

kk is the number of the test case, counting from 11, and pp is the percentage of the front of the house that is lit. Round to the nearest hundredth, round a value that lands exactly halfway up, and print exactly two digits after the decimal point. No test case has an answer within 10610^{-6} of a rounding boundary.