Consider a [billiard table](https://en.wikipedia.org/wiki/Billiard_table) of rectangular size $n \times m$ with four pockets. Let's introduce a coordinate system with the origin at the lower left corner (see the picture).
<center></center>There is one ball at the point $(x, y)$ currently. Max comes to the table and strikes the ball. The ball starts moving along a line that is parallel to one of the axes or that makes a $45^{\circ}$ angle with them. We will assume that:
1. the angles between the directions of the ball before and after a collision with a side are equal,
2. the ball moves indefinitely long, it only stops when it falls into a pocket,
3. the ball can be considered as a point, it falls into a pocket if and only if its coordinates coincide with one of the pockets,
4. initially the ball is not in a pocket.
Note that the ball can move along some side, in this case the ball will just fall into the pocket at the end of the side.
Your task is to determine whether the ball will fall into a pocket eventually, and if yes, which of the four pockets it will be.
## Input
The only line contains $6$ integers $n$, $m$, $x$, $y$, $v_x$, $v_y$ ($1 \leq n, m \leq 10^9$, $0 \leq x \leq n$; $0 \leq y \leq m$; $-1 \leq v_x, v_y \leq 1$; $(v_x, v_y) \neq (0, 0)$) — the width of the table, the length of the table, the $x$\-coordinate of the initial position of the ball, the $y$\-coordinate of the initial position of the ball, the $x$\-component of its initial speed and the $y$\-component of its initial speed, respectively. It is guaranteed that the ball is not initially in a pocket.
## Output
Print the coordinates of the pocket the ball will fall into, or $-1$ if the ball will move indefinitely.
[samples]
## Note
The first sample:
<center></center>The second sample:
<center></center>In the third sample the ball will never change its $y$ coordinate, so the ball will never fall into a pocket.
考虑一个尺寸为 $n \times m$ 的矩形台球桌,有四个袋口。我们建立一个坐标系,原点位于左下角(见图)。
当前有一个球位于点 $(x, y)$。Max 来到台球桌并击打该球,球开始沿平行于坐标轴或与坐标轴成 $45^\circ$ 角的直线运动。我们假设:
注意,如果球沿某条边运动,则球将直接落入该边末端的袋口中。
你的任务是确定球是否最终会落入某个袋口,如果会,是哪一个袋口。
输入仅一行包含 $6$ 个整数 $n$, $m$, $x$, $y$, $v_x$, $v_y$($1 \leq n, m \leq 10^9$,$0 \leq x \leq n$;$0 \leq y \leq m$;$-1 \leq v_x, v_y \leq 1$;$(v_x, v_y) \neq (0, 0)$)——分别表示台球桌的宽度、长度、球的初始位置的 $x$ 坐标、$y$ 坐标、初始速度的 $x$ 分量和 $y$ 分量。保证球初始时不在袋口中。
请输出球将落入的袋口的坐标,若球将无限运动则输出 $-1$。
第一个样例:
第二个样例:
在第三个样例中,球的 $y$ 坐标永远不会改变,因此球将永远不会落入袋口。
## Input
The only line contains $6$ integers $n$, $m$, $x$, $y$, $v_x$, $v_y$ ($1 \leq n, m \leq 10^9$, $0 \leq x \leq n$; $0 \leq y \leq m$; $-1 \leq v_x, v_y \leq 1$; $(v_x, v_y) \neq (0, 0)$) — the width of the table, the length of the table, the $x$-coordinate of the initial position of the ball, the $y$-coordinate of the initial position of the ball, the $x$-component of its initial speed and the $y$-component of its initial speed, respectively. It is guaranteed that the ball is not initially in a pocket.
## Output
Print the coordinates of the pocket the ball will fall into, or $-1$ if the ball will move indefinitely.
[samples]
## Note
第一个样例: 第二个样例: 在第三个样例中,球的 $y$ 坐标永远不会改变,因此球将永远不会落入袋口。
**Definitions**
Let $ n, m \in \mathbb{Z}^+ $ denote the width and height of the rectangular billiard table.
Let $ (x, y) \in [0, n] \times [0, m] $ denote the initial position of the ball, with $ (x, y) \notin \{(0,0), (0,m), (n,0), (n,m)\} $.
Let $ (v_x, v_y) \in \{-1, 0, 1\}^2 \setminus \{(0,0)\} $ denote the initial velocity vector, with components restricted to $ \{-1, 0, 1\} $.
The four pockets are located at:
- $ P_1 = (0, 0) $ — bottom-left
- $ P_2 = (n, 0) $ — bottom-right
- $ P_3 = (0, m) $ — top-left
- $ P_4 = (n, m) $ — top-right
**Constraints**
1. $ 1 \leq n, m \leq 10^9 $
2. $ 0 \leq x \leq n $, $ 0 \leq y \leq m $
3. $ v_x, v_y \in \{-1, 0, 1\} $, $ (v_x, v_y) \neq (0, 0) $
4. The ball is not initially in a pocket.
**Objective**
Determine whether the ball, moving with constant velocity $ (v_x, v_y) $ and reflecting elastically off the walls (i.e., reversing the appropriate velocity component upon hitting a wall), eventually falls into one of the four pockets.
If yes, output the coordinates of the pocket $ (p_x, p_y) \in \{ (0,0), (n,0), (0,m), (n,m) \} $ it enters.
If the ball moves indefinitely without entering any pocket, output $ -1 $.
**Key Insight**
The motion is constrained to discrete directions: horizontal, vertical, or diagonal ($ \pm 45^\circ $).
- If $ v_x = 0 $ and $ v_y \neq 0 $: ball moves vertically — falls into pocket only if $ x = 0 $ or $ x = n $ (but initial position is not in pocket, so never).
- If $ v_y = 0 $ and $ v_x \neq 0 $: ball moves horizontally — falls into pocket only if $ y = 0 $ or $ y = m $ (again, initial position not in pocket, so never).
- If $ |v_x| = |v_y| = 1 $: ball moves diagonally — use unfolding method: simulate reflections by tiling the plane with mirrored tables. The ball falls into a pocket iff there exists $ t > 0 $ such that:
$$
x + v_x t = a n, \quad y + v_y t = b m
$$
for some integers $ a, b \in \{0, 1\} $, corresponding to pocket coordinates.
Solve for $ t $:
$$
t = \frac{a n - x}{v_x} = \frac{b m - y}{v_y}
$$
and check if a common positive $ t $ exists with $ a \in \{0,1\}, b \in \{0,1\} $, and the resulting point is a pocket.
Since $ v_x, v_y = \pm 1 $, this reduces to checking 4 possible combinations of $ a, b \in \{0,1\} $ for consistency.