Problem: Consider a [billiard table](https://en.wikipedia.org/wiki/Billiard_table) of rectangular size n × m with four pockets. Let's introduce a coordinate system with the origin at the lower left corner (see the picture). 

<image>

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 ≤ n, m ≤ 10^9, 0 ≤ x ≤ n; 0 ≤ y ≤ m; -1 ≤ v_x, v_y ≤ 1; (v_x, v_y) ≠ (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.

Examples

Input

4 3 2 2 -1 1


Output

0 0

Input

4 4 2 0 1 1


Output

-1

Input

10 10 10 1 -1 0


Output

-1

Note

The first sample: 

<image>

The second sample: 

<image>

In the third sample the ball will never change its y coordinate, so the ball will never fall into a pocket.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long __gcd(long long a, long long b) {
  if (not a or not b) return a | b;
  return __gcd(b, a % b);
}
pair<long long, long long> exd_gcd(long long a, long long b) {
  if (a % b == 0) return {0, 1};
  pair<long long, long long> T = exd_gcd(b, a % b);
  return {T.second, T.first - a / b * T.second};
}
long long mul(long long x, long long y, long long mod) {
  long long ans = 0, m = abs(x), s = 0, sgn = (x > 0) xor (y > 0) ? -1 : 1;
  for (x = abs(x), y = abs(y); y; y >>= 1, m <<= 1, m = m >= mod ? m - mod : m)
    if (y & 1) s += m, s = s >= mod ? s - mod : s;
  return (s * sgn % mod + mod) % mod;
}
long long dangerous_mul(long long a, long long b, long long mod) {
  return (a * b - (long long)((long double)a * b / mod) * mod) % mod;
}
long long powmod(long long x, long long p, long long mod) {
  long long s = 1, m = x % mod;
  for (; p; m = mul(m, m, mod), p >>= 1)
    if (p & 1) s = mul(s, m, mod);
  return s;
}
pair<long long, long long> CRT(pair<long long, long long> eq1,
                               pair<long long, long long> eq2) {
  long long m1, m2, x1, x2;
  tie(x1, m1) = eq1, tie(x2, m2) = eq2;
  long long g = __gcd(m1, m2);
  if ((x1 - x2) % g) return {-1, 0};
  m1 /= g, m2 /= g;
  auto p = exd_gcd(m1, m2);
  long long lcm = m1 * m2 * g,
            res = mul(mul(p.first, (x2 - x1), lcm), m1, lcm) + x1;
  return {(res % lcm + lcm) % lcm, lcm};
}
long long up(long long a, long long n) { return (a % n + n) % n; }
int main() {
  long long n, m, x, y, vx, vy;
  scanf("%lld%lld%lld%lld%lld%lld", &n, &m, &x, &y, &vx, &vy);
  long long d = abs(__gcd(n, up(vx, n)));
  if (x % d) return 0 * puts("-1");
  pair<long long, long long> eq1 = {
      mul(exd_gcd(up(vx / d, n / d), n / d).first, up(-x / d, n / d), n / d),
      n / d};
  d = abs(__gcd(m, up(vy, m)));
  if (y % d) return 0 * puts("-1");
  pair<long long, long long> eq2 = {
      mul(exd_gcd(up(vy / d, m / d), m / d).first, up(-y / d, m / d), m / d),
      m / d};
  auto P = CRT(eq1, eq2);
  if (P.second == 0) return 0 * puts("-1");
  long long t = (P.first % P.second + P.second) % P.second;
  long long xx = x + vx * t, yy = y + vy * t;
  if (xx % n or yy % m) return 0 * puts("-1");
  printf("%lld %lld\n", n * ((xx / n) % 2 != 0), m * ((yy / m) % 2 != 0));
}