Sewerage Planning

No attempts yetTime limit1sMemory limit128 MB

Problem

ICPC City is a fast-growing city. Its population has risen so quickly that several public facilities now need to be improved, extended, or renovated. One of them is the sewerage system: a recent report says a new sewerage backbone pipeline must be built across the city. Even though modern sewerage systems are kept clean by an automated control system, residents still want the backbone pipeline placed as far from them as possible.

ICPC City is a well-planned, perfectly rectangular city whose four vertices are (L,B)(L, B), (L,T)(L, T), (R,T)(R, T), and (R,B)(R, B) for some L<RL < R and B<TB < T. The backbone pipeline must be a straight line that crosses the city, because it connects the neighboring regions on the two sides. We want the pipeline to lie as far as possible from everyone in the city. The population is given as a set of NN points Pi=(Xi,Yi)P_i = (X_i, Y_i) with LXiRL \le X_i \le R and BYiTB \le Y_i \le T.

For any line ll that passes through the city area, define the objective function

δ(l)=mini=1,,Nd(Pi,l),\delta(l) = \min_{i = 1, \dots, N} d(P_i, l),

where d(Pi,l)d(P_i, l) is the Euclidean (perpendicular) distance from point PiP_i to line ll. In other words, δ(l)\delta(l) is the smallest of the distances from all PiP_i to line ll.


Figure 1. Computing δ(l)\delta(l) for a given line ll through the city area.

An optimal backbone plan is a line ll^* that maximizes δ(l)\delta(l) over all lines ll that intersect the rectangle with vertices (L,B)(L, B), (L,T)(L, T), (R,T)(R, T), and (R,B)(R, B). Figure 2 shows three basic cases of an optimal plan ll^*.


Figure 2. Three basic examples.

Write a program that, given LL, RR, BB, TT, and the NN points PiP_i, finds the value δ(l)\delta(l^*) for an optimal backbone plan ll^*.

Input

The input is read from standard input. The first line contains the number of test cases KK (1K20)(1 \le K \le 20). Each test case is given as follows.

The first line of a test case contains four real numbers LL, RR, BB, TT (1000L<R1000; 1000B<T1000)(-1000 \le L < R \le 1000;\ -1000 \le B < T \le 1000) that define the city area. The next line contains one integer NN (1N500)(1 \le N \le 500), the number of points. Each of the following NN lines contains two real numbers XiX_i and YiY_i, the XX-coordinate and YY-coordinate of point PiP_i, with LXiRL \le X_i \le R and BYiTB \le Y_i \le T.

Every real number is given with exactly three digits after the decimal point, and two numbers on the same line are separated by a single space.

Output

The output is written to standard output. For each test case, print exactly one line containing the value δ(l)\delta(l^*) for an optimal backbone plan ll^*. Print the value rounded to exactly three digits after the decimal point.