AT_past18_n 平面徒競走
Description
Two runners, T and A, are competing in a footrace on a two-dimensional plane. T starts at $ (T_x,T_y) $ and runs at a speed of $ V_T $ per second. A starts at $ (A_x,A_y) $ and runs at a speed of $ V_A $ per second.
Once the whistle is blown, they start running simultaneously from their individual starting points toward a common goal. The goal has a fixed $ x $ coordinate of $ 0 $ , but its $ y $ coordinate is not determined yet. (Here, it is guaranteed that $ T_x \neq 0 $ and $ A_x \neq 0 $ .)
You want to determine the $ y $ coordinate of the goal so that T never loses the race (that is, T reaches the goal first, or the two runners reach the goal at the same time). Let $ S $ be the set of $ y $ coordinates that achieve the objective.
- If $ S $ is empty, print $ 0 $ ;
- if $ S $ is non-empty, and $ S $ has both the maximum and minimum values, then print the difference between them;
- if $ S $ is non-empty, but $ S $ does not have both the maximum and minimum values, then print `inf`.
Input Format
The input is given from Standard Input in the following format:
> $ T_x $ $ T_y $ $ V_T $ $ A_x $ $ A_y $ $ V_A $
Output Format
Print the result as a real value, or `inf`. If the answer is a real value, your output is considered correct if its absolute or relative error from the true value is at most $ 10^{−9} $ .
Explanation/Hint
### Sample Explanation 1
We consider two $ y $ coordinates of the goal as examples.
- If $ y=0 $ : it takes $ \frac{1}{1}=1 $ seconds for T, and $ \frac{\sqrt{10}}{2}=1.58\dots $ seconds for A, to reach the goal.
- If $ y=2 $ : it takes $ \frac{\sqrt{5}}{1}=2.23\dots $ seconds for T, and $ \frac{\sqrt{2}}{2}=0.70\dots $ seconds for A, to reach the goal.
One can prove that T reaches the goal first, or the two runners reach the goal at the same time if and only if $ -1-\sqrt{3} \leq y \leq -1+\sqrt{3} $ .
Thus, the maximum value of $ S $ is $ -1+\sqrt{3} $ , and its minimum value is $ -1-\sqrt{3} $ , so the answer is $ (-1+\sqrt{3})-(-1-\sqrt{3})=2\sqrt{3}=3.46\dots $ .
### Sample Explanation 2
Regardless of the $ y $ coordinate of the goal, A always reaches the goal earlier than T, so $ S $ is empty.
### Sample Explanation 3
$ S $ has neither the maximum nor minimum value.
### Constraints
- $ -10^4 \leq T_x,T_y,A_x,A_y \leq 10^4 $
- $ T_x \neq 0 $
- $ A_x \neq 0 $
- $ 1 \leq V_T,V_A \leq 10^2 $
- All input values are integers.