Universal Cup Judging System

Universal Cup

時間限制: 1 s 記憶體限制: 512 MB 總分: 100 可 Hack ✓
统计

You are about to cross the road, but an e-bike is speeding along it.

In the Cartesian plane, a road of width $w$ extends infinitely in the $x$-direction and occupies the strip $0 \le y \le w$. You start from the fixed point $(0,0)$ and want to reach any point on the upper boundary $y=w$, while avoiding an e-bike on the road.

The e-bike’s body is represented by a line segment parallel to the $x$-axis. At time $t=0$, its endpoints are $(x_1,y_c)$ and $(x_2,y_c)$, where $x_1<x_2$. The e-bike moves with constant horizontal velocity $u$, so at time $t$ its endpoints are at $(x_1+ut,y_c)$ and $(x_2+ut,y_c)$.

You may move in any direction or wait, but your speed must never exceed $v$. Equivalently, for any two times $0 \le t_1 \le t_2$, the Euclidean distance between your positions at those times must be at most $v(t_2-t_1)$. At no time may you be on the e-bike’s segment except at its endpoints; touching either endpoint is allowed.

You start from $(0,0)$ at time $t=0$. Find the minimum time needed to reach any point on $y=w$ safely. It can be shown that an answer always exists.

Input

The first line contains an integer $T$ ($1 \le T \le 2000$), the number of test cases.

Each test case consists of one line containing six integers $w,x_1,x_2,y_c,u,v$ ($2 \le w \le 4\times 10^4$, $-4\times 10^4 \le x_1<x_2 \le 4\times 10^4$, $1 \le y_c \le w-1$, $-4\times 10^4 \le u \le 4\times 10^4$, $1 \le v \le 4\times 10^4$). Here, $w$ is the width of the road, $(x_1,y_c)$ and $(x_2,y_c)$ are the e-bike’s endpoints at time $t=0$, $u$ is the e-bike’s horizontal velocity, and $v$ is your maximum speed.

Output

For each test case, output one real number on a separate line: the minimum time needed to reach $y=w$ safely.

Your answer is considered correct if its absolute or relative error does not exceed $10^{-6}$. More precisely, for each value $a$ you output and the corresponding reference value $b$, the requirement is $\frac{|a-b|}{\max(1,|b|)} \le 10^{-6}$.

Examples

Input 1

3
10 100 110 5 3 1
10 -2 2 1 1 2
10 -2 2 1 -1 1

Output 1

10.000000000
5.286299648
10.250000000

Note

The figure below shows the initial state ($t=0$) of the second test case in the sample. The orange segment represents the e-bike, and the blue point $S=(0,0)$ is your starting point. The arrow indicates the e-bike’s direction of motion, with $u=1$.

problem_20717_3d9454542aceb5821b2ffc330f9ae658.png

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.