To school by bicycle
Petya loves cycling to school, but he must stick to the designated bike paths since riding on sidewalks is not allowed and the roads are unsafe. Luckily, both his home and school are conveniently located near these paths.
In Petya's city, there are exactly two circular bike paths. These paths intersect at certain points, allowing cyclists to switch from one path to the other.
Petya knows the exact point where he will enter the bike path and the point where he needs to exit to reach his school. He wants to find out the shortest distance he needs to travel along these paths to get from his home to school.
Input
The city uses a rectangular Cartesian coordinate system.
The first two lines of input describe the bike paths. Each line contains three integers: the coordinates of the center of the circle representing the path and its radius. The coordinates and radius are within an absolute value of 300, and the radius is a positive number. It is guaranteed that the paths do not overlap.
The next two lines each contain two real numbers, representing the coordinates of the entry point onto the path and the exit point from the path. It is guaranteed that each point lies precisely on one of the paths (the distance from the point to the center of one of the circles differs from its radius by no more than 10^{-8}). The points may be on the same path or on different paths.
Output
Output the minimum distance Petya should travel on the bike paths to get from his home to school. The answer should be accurate within 10^{-4} of the correct value.
If it is impossible to travel from home to school using the bike paths, output -1.