H. High-Speed Collision
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Pedro Pacoca enjoys playing an online car racing game and recently discovered that his colleague Pedro Gallo also plays the game. Excited by this, the two Pedros decided to help each other.

In the game, each player drives a car around a circuit, and the player who completes the course in the shortest time wins. To achieve this, it is crucial for players to avoid crashing their cars into others.

Knowing this, the two Pedros decided to share the initial positions of their cars, their speeds, and the directions they were moving. They also agreed to maintain both their speeds and directions constant.

Now, they need your help to determine if there will be a collision between the two cars. Given the initial positions and the speeds in the $$$x$$$ and $$$y$$$ directions for each car, determine the moment in time when a collision will happen. If no collision occurs, output $$$-1$$$.

For the purposes of collision detection in this problem, each car is modeled as a triangle on the plane.

Input

The input consists of four lines. The first two lines describe the first car, and the last two lines describe the second car.

Each car is described by two lines:

  • The first line contains six integers $$$x_1$$$, $$$y_1$$$, $$$x_2$$$, $$$y_2$$$, $$$x_3$$$, and $$$y_3$$$ $$$(-10^5 \leq x_i, y_i \leq 10^5)$$$. $$$(x_1, y_1)$$$, $$$(x_2, y_2)$$$, and $$$(x_3, y_3)$$$ are the coordinates of the vertices of the collision triangle of the car.
  • The second line contains two integers $$$v_x$$$ and $$$v_y$$$ $$$(-10^5 \leq v_x, v_y \leq 10^5)$$$. $$$(v_x, v_y)$$$ is the speed of the car in the $$$x$$$ and $$$y$$$ directions.

It is guaranteed that the provided vertices form a non-degenerate triangle. Furthermore, it is also guaranteed that collision triangles do not intersect. That is, there is no point $$$p$$$ that belongs to both triangles simultaneously.

Output

Print a single line containing a real number: the moment in time when a collision will occur between the cars, or $$$-1$$$, if there is no collision.

Your answer will be considered correct if the absolute or relative error does not exceed $$$10^{-6}$$$.

Examples
Input
0 0 1 0 0 1
1 0
1 1 2 1 1 2
0 -1
Output
0.5
Input
0 0 1 0 0 1
1 0
5 0 5 -1 4 0
-3 0
Output
0.75
Input
2 2 2 0 7 3
4 2
3 3 8 7 10 8
1 0
Output
-1