Escaping the Tutoring House

No attempts yetTime limit1sMemory limit128 MB

Problem

Seunghyeok is a private tutor. Word of his skill spread so widely that he ended up teaching as many as 1,000 mischievous kids at once. When the kids became completely uncontrollable, Seunghyeok decided to escape the house.

While a kid is inside Seunghyeok's field of view, it stays perfectly still. But the instant a kid leaves his field of view, it dashes at the speed of light and smacks the back of his head, and Seunghyeok can neither block nor dodge it. Seunghyeok's field of view is the forward 180 degrees centered on the direction he faces (exactly a half-plane), and he can see everything within it perfectly. He can continuously change the direction he faces while moving, and he can also walk backward.

The house has only one exit. Seunghyeok must reach the exit without ever losing sight of any kid for even a moment, that is, without being hit even once. Determine whether this is possible, and if so, find the minimum distance he must travel.

Input

The first line contains the number of test cases $T$. ($1 \le T \le 100$)

Each test case is given as follows.

  • Line 1: Seunghyeok's starting position $x_L$ and $y_L$
  • Line 2: the exit's position $x_E$ and $y_E$
  • Line 3: the number of kids $n$ ($1 \le n \le 1000$)
  • The next $n$ lines: each kid's position $x_i$ and $y_i$

All coordinates are integers with $-10000 \le x, y \le 10000$. No two of the points (Seunghyeok, the exit, and the kids) occupy the same location.

Output

For each test case, print the answer on its own line.

  • If Seunghyeok can escape without being hit, print the minimum distance he must travel, rounded to three decimal places.
  • If escaping is impossible, print IMPOSSIBLE.

It is guaranteed that an absolute error of up to $10^{-6}$ in the answer does not change the rounded result.