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 n, m, p, q, x, y, r, a, b, e, f, t;
struct bignum {
  int a[50];
  int len;
  void print() {
    for (int i = len - 1; i >= 0; i--) printf("%d", a[i]);
    printf("\n");
  }
  void clearf() {
    for (int i = 0; i < len; i++) a[i] = 0;
    len = 1;
  }
  bignum operator+(const bignum &b) {
    bignum t;
    int l = max(len, b.len);
    if (l == len) {
      for (int i = 0; i < b.len; i++) t.a[i] = a[i] + b.a[i];
      for (int i = b.len; i < l; i++) t.a[i] = a[i];
    } else {
      for (int i = 0; i < len; i++) t.a[i] = a[i] + b.a[i];
      for (int i = len; i < l; i++) t.a[i] = b.a[i];
    }
    t.a[l] = 0;
    for (int i = 0; i < l; i++) {
      t.a[i + 1] += t.a[i] / 5;
      t.a[i] %= 5;
    }
    t.len = l + (t.a[l] > 0);
    return t;
  }
  bignum operator-(const bignum &b) {
    bignum t;
    int l = len;
    for (int i = 0; i < b.len; i++) t.a[i] = a[i] - b.a[i];
    for (int i = b.len; i < l; i++) t.a[i] = a[i];
    for (int i = 0; i < l; i++) {
      if (t.a[i] < 0) {
        t.a[i] += 5;
        t.a[i + 1]--;
      }
    }
    while (l > 1 && t.a[l - 1] == 0) l--;
    t.len = l;
    return t;
  }
  bignum operator*(const bignum &b) {
    bignum t;
    int l = len + b.len;
    for (int i = 0; i < l; i++) t.a[i] = 0;
    for (int i = 0; i < len; i++)
      for (int j = 0; j < b.len; j++) t.a[i + j] += a[i] * b.a[j];
    for (int i = 0; i < l; i++) {
      t.a[i + 1] += t.a[i] / 5;
      t.a[i] %= 5;
    }
    while (l > 1 && t.a[l - 1] == 0) l--;
    t.len = l;
    return t;
  }
  bignum operator/(const int &b) {
    bignum t;
    int l = len;
    for (int i = 0; i < l; i++) t.a[i] = 0;
    int k = 0;
    for (int i = len - 1; i >= 0; i--) {
      k = k * 5 + a[i];
      t.a[i] = k / b;
      k %= b;
    }
    while (l > 1 && t.a[l - 1] == 0) l--;
    t.len = l;
    return t;
  }
  long long operator%(const long long &b) {
    long long k = 0;
    for (int i = len - 1; i >= 0; i--) {
      k = k * 5 + a[i];
      k %= b;
    }
    return k;
  }
  bool operator<(const bignum &b) {
    if (len != b.len) return len < b.len;
    for (int i = len - 1; i >= 0; i--)
      if (a[i] != b.a[i]) return a[i] < b.a[i];
    return false;
  }
};
bignum get_bignum(long long x) {
  bignum tmp;
  int r = 0;
  while (x) {
    tmp.a[r++] = x % 5;
    x /= 5;
  }
  tmp.len = r;
  return tmp;
}
long long phi(long long x) {
  long long rt = x;
  for (long long j = 2; j * j <= x; j++) {
    if (x % j) continue;
    rt = rt / j * (j - 1);
    while (x % j == 0) x /= j;
  }
  if (x > 1) rt = rt / x * (x - 1);
  return rt;
}
long long pow_(long long x, long long y, long long z) {
  long long rt = 1;
  while (y) {
    if (y & 1) rt = rt * x % z;
    y >>= 1;
    x = x * x % z;
  }
  return rt;
}
long long gcd(long long x, long long y) {
  if (x % y == 0)
    return y;
  else
    return gcd(y, x % y);
}
long long solve(long long a, long long b, long long c, long long d) {
  long long u = phi(b), v = phi(d);
  e = pow_(d, u - 1, b);
  f = pow_(b, v - 1, d);
  bignum o1, o2, o3, o4, o5, o6, rt;
  o1 = get_bignum(a);
  o2 = get_bignum(d);
  o3 = get_bignum(e);
  o4 = get_bignum(b);
  o5 = get_bignum(c);
  o6 = get_bignum(f);
  rt = o1 * o2 * o3 + o4 * o5 * o6;
  return rt % (b * d);
}
int main() {
  cin >> n >> m >> x >> y >> p >> q;
  if (p * q) {
    r = gcd(n, m);
    if ((p * x - q * y) % r) {
      cout << -1 << endl;
      return 0;
    }
    a = (p == 1) ? n - x : x;
    b = (q == 1) ? m - y : y;
    long long res = a % r;
    long long tmp = solve(a / r, n / r, b / r, m / r) * r + res;
    t = p * (tmp % (n * 2)) + x;
    x = t / n;
    t = q * (tmp % (m * 2)) + y;
    y = t / m;
    if (x & 1)
      cout << n << ' ';
    else
      cout << 0 << ' ';
    if (y & 1)
      cout << m << endl;
    else
      cout << 0 << endl;
  } else {
    if (p == 1) {
      if (y == 0)
        cout << n << ' ' << 0 << endl;
      else if (y == m)
        cout << n << ' ' << m << endl;
      else
        cout << -1 << endl;
    }
    if (p == -1) {
      if (y == 0)
        cout << 0 << ' ' << 0 << endl;
      else if (y == m)
        cout << 0 << ' ' << m << endl;
      else
        cout << -1 << endl;
    }
    if (q == 1) {
      if (x == 0)
        cout << 0 << ' ' << m << endl;
      else if (x == n)
        cout << n << ' ' << m << endl;
      else
        cout << -1 << endl;
    }
    if (q == -1) {
      if (x == 0)
        cout << 0 << ' ' << 0 << endl;
      else if (x == n)
        cout << n << ' ' << 0 << endl;
      else
        cout << -1 << endl;
    }
  }
}