eolymp
bolt
Try our new interface for solving problems
Problems

About love...

About love...

The spider-male and the spider-female sale along the lake on two twigs. They do not know how to swim, so they can only meet when the twigs come in contact.

prb2221

Considering that the twigs are in the form of segments, and that they sale at constant speeds, determine how long it will take the unhappy arthropods to meet.

Input

Contains 12 numbers: x1, y1, x2, y2, x3, y3, x4, y4, v1x, v1y, v2x, v2y. The vertex coordinates of the first segment: (x1, y1) и (x2, y2), the vertex coordinates of the second segment: (x3, y3) и (x4, y4), the speed of the first segment (v1x, v1y), the speed of the second segment (v2x, v2y). All numbers are integer, not exceeding 104 by absolute value. At the initial time the twigs do not touch.

It is guaranteed that the twigs have non-zero length.

Output

Print the time to the nearest moment, when the twigs come into contact, with an error of not more than 10-4. If the twigs never come in contact, print a number -1.

Time limit 1 second
Memory limit 128 MiB
Input example #1
0 0 -1 3
4 4 7 7
3 0
0 -1
Output example #1
1.6000000000
Input example #2
0 0 -1 3
4 4 7 7
1 0
0 -3
Output example #2
-1
Source 2006, XIV St. Petersburg School Programming Team Championship, November 6, Problem E