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.
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: x[1]
, y[1]
, x[2]
, y[2]
, x[3]
, y[3]
, x[4]
, y[4]
, v[1x]
, v[1y]
, v[2x]
, v[2y]
. The vertex coordinates of the first segment: (x[1], y[1])
и (x[2], y[2])
, the vertex coordinates of the second segment: (x[3], y[3])
и (x[4], y[4])
, the speed of the first segment (v[1x], v[1y])
, the speed of the second segment (v[2x], v[2y])
. All numbers are integer, not exceeding 10^4
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.