Universal Cup Judging System

Universal Cup

Limite de temps : 2.0 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓
Statistiques

On an infinite table, you are given two distinct points $A = (A_x, A_y)$ and $B = (B_x, B_y)$.

You also have $M$ sticks, each being a line segment of length $W$. You may place these sticks anywhere on the table, with any position and orientation. Sticks are allowed to overlap. However, no stick may contain point $A$ or point $B$.

An ant starts at $A$ and wants to reach $B$. It may walk anywhere on the table, except that it cannot cross any stick.

You want to place the sticks so that the length of the shortest path for the ant from $A$ to $B$ is as large as possible.

If it is possible to block the ant completely so that no path from $A$ to $B$ exists, the answer is $-1$.

Otherwise, let $L$ be the supremum$^\dagger$ of the shortest-path lengths from $A$ to $B$ over all valid placements of the sticks. If there is a placement that achieves this value, $L$ is simply the maximum. If no single placement achieves it, but placements can get arbitrarily close, you must still output $L$.

$^\dagger$ The supremum (least upper bound) of a set of real numbers is the smallest real number that is greater than or equal to every value in the set. It may or may not be achieved by a value in the set.

Input

The input is given in the following format:

T
A_x A_y B_x B_y M W
...
  • All input values are integers.
  • $1 \le T \le 10^4$
  • $0 \le A_x, A_y, B_x, B_y \le 10^9$
  • $1 \le M, W \le 10^9$
  • It is guaranteed that $(A_x, A_y) \ne (B_x, B_y)$.

Output

For each test case:

  • Print $-1$ if the ant can be blocked completely;
  • Otherwise, print a single real number — the value $L$ defined above.

Let $X$ be the correct answer and $Y$ be your output. Your output is considered correct if and only if $|Y - X| \le 10^-6 \cdot \max(1, |X|)$.

Example

Input 1

2
0 0 1 1 343 434
4 5 786331192 707731892 1 639711202

Output 1

-1
1425074478.231629371643066

Note

Test case 1: It can be shown that by placing the sticks optimally, the ant can be blocked completely.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.