Geometry
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
Special Judge, 64bit IO Format: %lld

题目描述

NIO loves geometry.

One day he came out with a problem: given two convex polygons in a 2-dimension plane, each with a velocity, what is the moment when they collide? In this problem, it is considered to be a collision that two convex polygons share one point.

输入描述:

The first line contains an integer n (), denoting the number of vertices of the first convex polygon. Then follows n lines, each line contains two integers x_i, y_i (), denoting the ith point of the convex polygon. The points are given in counter-clockwise order.

Then follows an integer m (), and then m lines, denoting the second polygon. The format and restrictions are the same as above.

The last line contains four integers (). The velocity of the first polygon is (vx_1,vy_1) and the velocity of the second polygon is (vx_2, vy_2).

输出描述:

Output a single real number t, indicating how many units of time they collided after the initial state. If the two convex polygons collide at the initial state, print 0. If they will never collide, print -1.

Your answer will be judged to be correct if the relative or absolute error with the jury's answer is less than or equal to .
示例1

输入

复制
3
0 0
1 1
0 1
3
0 0
-1 -1
0 -1
1 1 -1 -1

输出

复制
0
示例2

输入

复制
4
0 0
1 0
1 1
0 1
4
0 3
1 3
1 4
0 4
1 1 0 0

输出

复制
-1
示例3

输入

复制
4
0 0
1 0
1 1
0 1
4
0 2
1 2
1 3
0 3
0 0 -2 -2

输出

复制
0.5