PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000411. Sợ bóng tối (Fear of the Dark)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Sợ bóng tối (Fear of the Dark)

Fear of the Dark

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Monocarp starts at O=(0,0)O=(0,0) and wants to reach home at P=(Px,Py)P=(P_x,P_y) using only illuminated locations. Lamps at A=(Ax,Ay)A=(A_x,A_y) and B=(Bx,By)B=(B_x,B_y) are assigned the same real power w≥0w\ge0. Each illuminates the closed disk of radius ww centered at its location. The lamps do not obstruct movement. Find the smallest ww for which a continuous, entirely illuminated route joins OO to PP.

Input

Line 1 contains integers Px,PyP_x,P_y. Line 2 contains Ax,AyA_x,A_y. Line 3 contains Bx,ByB_x,B_y.

Output

Print the minimum radius ww. The absolute or relative error must not exceed 10−610^{-6}.

Subtasks

  • Subtask 1 (20 points): −100≤Px,Py,Ax,Ay,Bx,By≤100-100\le P_x,P_y,A_x,A_y,B_x,B_y\le 100; O,P,A,BO,P,A,B are pairwise distinct. Py=Ay=By=0P_y=A_y=B_y=0.
  • Subtask 2 (30 points): −100≤Px,Py,Ax,Ay,Bx,By≤100-100\le P_x,P_y,A_x,A_y,B_x,B_y\le 100; O,P,A,BO,P,A,B are pairwise distinct.
  • Subtask 3 (50 points): −1000≤Px,Py,Ax,Ay,Bx,By≤1000-1000\le P_x,P_y,A_x,A_y,B_x,B_y\le 1000; O,P,A,BO,P,A,B are pairwise distinct.

Examples

Input

3 3
1 0
-1 6

Output

3.6055512755

Explanation

Lamp A is 1 unit from OO and 13\sqrt{13} units from PP. At radius 13\sqrt{13} its disk contains the segment OPOP. A smaller radius leaves PP outside both disks, since B is 5 units from PP. The minimum is 13≈3.6055512755\sqrt{13}\approx3.6055512755.

Input

3 3
-1 -1
4 3

Output

3.2015621187

Explanation

Lamp A is 2\sqrt2 from OO; B is one unit from PP. Their separation is 41\sqrt{41}, so at w=41/2w=\sqrt{41}/2 the disks touch. A path through that contact point connects the endpoints. A smaller radius leaves the disks disjoint, and neither lamp alone covers both endpoints since AP=32AP=\sqrt{32} and BO=5BO=5.

Sample illustration