**1 人解决**，6 人已尝试。

**1 份提交通过**，共有 18 份提交。

**9.9** EMB 奖励。

**单点时限: **4.0 sec

**内存限制: **512 MB

Barney the polar has wandered off on an adventure. Lost in thought, he suddenly realizes 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. He is very scared, and can not swim. Barney’s mother, getting a little tired of her son’s shenanigans, decides to wait and let him figure this out for himself. Can you help Barney get home? He is in a hurry.

The first line of input contains four integers, $−10^6 \le x_b,y_b,x_m,y_m \le 10^6$, where $(x_b,y_b)$ is Barney’s location and $(x_m,y_m)$ is the location where Barney’s mom is waiting.

The next line contains a single integer $1 \le n \le 25$, the number of ice shelves.

After this $n$ lines follow. Each line holds three integers: $−10^6 \le x_i,y_i \le 10^6$ and $1 \le r_i \le 10^6$, the coordinates of the center of the shelf and its radius. A shelf consists of all points at distance $r_i$ or less to $(x_i,y_i)$.

Both bears are on a shelf at the start of Barney’s journey home. Shelves can both touch and overlap.

The minimal distance Barney has to travel to be reunited with his mother. The result should have a relative error of at most $10^{−6}$.

If there is no way for Barney to make it home, output `impossible`

. (Do not worry about Barney’s well-being in this scenario. His mother will swim out to save him.)

Input

0 0 6 0 2 1 1 2 5 1 2

Output

6.32455532034

Input

0 0 7 0 2 1 1 2 6 1 2

Output

impossible

Input

0 0 1 3 3 0 -1 2 4 -1 3 2 3 2

Output

4.269334912857045697

**1 人解决**，6 人已尝试。

**1 份提交通过**，共有 18 份提交。

**9.9** EMB 奖励。

题目标签