Universal Cup Judging System

Universal Cup

Límite de tiempo: 2 s Límite de memoria: 512 MB Puntuación total: 100 Hackeable ✓
Estadísticas

You are about to cross the road, but a car 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 want to cross it from the lower boundary $y=0$ to the upper boundary $y=w$, while avoiding a car on the road.

The car’s body is represented by a simple polygon with $n$ vertices. At time $t=0$, its vertices are $(x_1,y_1),(x_2,y_2),\ldots,(x_n,y_n)$ in counterclockwise boundary order. The car moves with constant horizontal velocity $u$, so at time $t$ its $i$-th vertex is at $(x_i+ut,y_i)$.

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 strictly inside the car’s body; touching its boundary is allowed.

You are given $q$ independent queries. In the $j$-th query, you start from $(s_j,0)$ at time $t=0$. Find the minimum time needed to reach any point on $y=w$ safely. For every query, the car starts again from the same given configuration at $t=0$; the queries do not affect one another. It can be shown that an answer always exists.

Input

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

Each test case begins with a line containing four integers $n,w,u,v$ ($3\le n\le5\times10^5$, $1\le w,v\le10^9$, $-10^9\le u\le10^9$): the number of vertices of the car, the width of the road, the car’s horizontal velocity, and your maximum speed, respectively.

The next $n$ lines describe the car at time $t=0$. The $i$-th line contains two integers $x_i,y_i$ ($-10^9\le x_i\le10^9$, $0\le y_i\le w$), the coordinates of its $i$-th vertex. The vertices are given in counterclockwise boundary order and form a simple polygon: non-adjacent edges have no common point, adjacent edges intersect only at their common endpoint, and no three consecutive vertices are collinear.

The next line contains an integer $q$ ($1\le q\le5\times10^5$), the number of queries. Each of the following $q$ lines contains an integer $s_j$ ($-10^9\le s_j\le10^9$), specifying the starting point $(s_j,0)$ for the $j$-th query.

It is guaranteed that both the sum of $n$ and the sum of $q$ over all test cases do not exceed $5\times10^5$.

Output

For each query, 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|)}\le10^{-6}$.

Examples

Input 1

3
6 10 1 3
-3 3
3 3
3 5
1 5
1 7
-3 7
3
0
6
-6
4 20 5 1
-12 2
2 2
2 10
-2 10
2
0
-12
4 8 2 5
-5 0
5 0
5 8
-5 8
2
-3
3

Output 1

3.504497942940
3.333333333333
3.333333333333
20.211324865405
20.000000000000
1.885714285714
2.412409788555

Note

The figure below shows the initial state ($t=0$) for the first query of the first test case in the sample. The orange polygon represents the car, and the blue point $S=(0,0)$ is your starting point. The arrow indicates the car’s direction of motion, with $u=1$.

problem_20718_4cde8a47db6268ea7eae14c45d3d64d3.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.