cho.sh
Notes
Loading...

Jumping Fences

Time limit

2s

Memory limit

128 MB

Problem

There are N visitable points on a plane and one separate starting point. Every visitable point and the starting point are given by coordinates (x, y), and all coordinates satisfy 0 <= x, y <= 1,000,000. You must start at the starting point, visit exactly K of the visitable points, and return to the starting point. The same point may be visited more than once, but the same point may not be visited twice in a row. The starting point is not counted among the K visits.

The plane also contains F fences. Each fence is a line segment between two endpoints, and no two fences intersect each other. Each fence has a height h; the probability of successfully jumping over a fence of height h once is 1/h.

When moving from one point to another, you always travel along the straight segment between them. If that path meets a fence, you must jump over it. If a move meets several fences, all of them must be cleared, so the success probability for that move is the product of the individual success probabilities. If a fence lies parallel to the movement path, it does not affect the success probability. If the movement path merely touches an endpoint of a fence, that fence does not need to be jumped.

Among all routes that visit exactly K points and return to the starting point, find the maximum probability that every required fence jump succeeds.

Input

The first line contains five integers N, K, F, x, and y. The coordinates (x, y) are the starting point. Each of the next N lines contains the coordinates of one visitable point. Each of the following F lines contains five integers describing one fence: the first two integers are one endpoint, the next two integers are the other endpoint, and the last integer is the height h.

Output

Print the maximum possible success probability on the first line. Output in %.4e format is accepted.