Find the shortest path between two points where movement is allowed only on or inside up to 25 given circles.
Medium7GraphShortest pathGeometryBrute forceNo attempts yetTime limit2sMemory limit512 MBBarney the polar bear wandered off on an adventure. Lost in thought, he suddenly realizes that he has strayed too far from his mother and is stuck on an ice shelf. He can still see her in the distance, but the only way back is by crossing a group of other ice shelves, all of which are perfectly circular. Barney cannot swim, so he moves only over points that the shelves cover. His mother, a little tired of her son's shenanigans, decides to wait and let him figure this out for himself. Find the smallest distance Barney has to travel to reach her. He is in a hurry.
Both bears are on a shelf at the start of Barney's journey home. Shelves can touch at a single point and can overlap.
Print the minimal distance Barney has to travel to be reunited with his mother, rounded to exactly six digits after the decimal point. Print all six digits even when the value is exact.
If there is no way for Barney to make it home, print impossible instead. Do not worry about Barney's well-being in this scenario. His mother will swim out to save him.

The third example input. The green dot is Barney and the red dot is his mother.