Scientists believe that the mitochondria in eukaryotic cells actually came from early cells engulfing mitochondria through a process known as endosymbiosis. Now, people refer to this theory as Symbiogenesis.
As a scientist working in the Karyotype Analysis and Replication Project (KARP for short), you are simulating how this may happen.
You have a rectangular box with sides parallel to the $$$x$$$ and $$$y$$$ axes, with its bottom-left corner at $$$(0,0)$$$ and its upper-right corner at $$$(w,h)$$$. A cell starts in the bottom-left corner and moves at a constant velocity with an initial vector of $$$(x_1,y_1)$$$ (the $$$x$$$ velocity is $$$x_1$$$ units/second, and the $$$y$$$ velocity is $$$y_1$$$ units/second). A mitochondrion starts in the top-right corner and moves at a constant velocity with an initial vector of $$$(-x_2,-y_2)$$$. Whenever a cell or mitochondrion hits a wall, it will bounce off the wall perfectly, without changing its speed.
You are given $$$n$$$ versions of this setup. For each setup, how many seconds will it take for the cell and mitochondrion to meet for the first time? If they will never meet, print out $$$-1$$$ instead.
The first line of input contains $$$n$$$ ($$$1\le n\le 2\cdot 10^5$$$) — the number of setups.
The $$$i^\text{th}$$$ line of the next $$$n$$$ lines contains $$$w_i$$$, $$$h_i$$$, $$$x_{i_1}$$$, $$$y_{i_1}$$$, $$$x_{i_2}$$$, $$$y_{i_2}$$$ ($$$1\le w_i,h_i\le 10^9, 0\le x_{i_1},y_{i_1},x_{i_2},y_{i_2}\le 10^9$$$) — the width, height, velocity of the cell $$$(x_{i_1}, y_{i_1})$$$, and the velocity of the mitochondrion $$$(-x_{i_2}, -y_{i_2})$$$ for the $$$i^\text{th}$$$ setup. It is guaranteed that $$$x_{i_1}$$$ and $$$y_{i_1}$$$ are not both $$$0$$$. It is also guaranteed that $$$x_{i_2}$$$ and $$$y_{i_2}$$$ are not both $$$0$$$.
Output $$$n$$$ numbers, the $$$i^\text{th}$$$ of which represents the minimum number of seconds it will take for the cell and mitochondrion to meet for setup $$$i$$$. Your answer will be considered correct if it is within $$$10^{-6}$$$ of relative or absolute error. If the cell and mitochondrion never meet, output $$$-1$$$ instead.
22 2 1 3 1 32 2 1 1 1 3
1.0000000000 1.0000000000