#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, vx, vy, ty;
long long xGCD(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1, y1, gcd = xGCD(b, a % b, x1, y1);
  x = y1;
  y = x1 - (a / b) * y1;
  return gcd;
}
long long diophantine(long long a, long long b, long long c, long long &x,
                      long long &y) {
  long long val = xGCD(a, b, x, y);
  if (c % val) {
    x = -1;
    return -1;
  }
  a /= val;
  b /= val;
  c /= val;
  x *= c;
  x %= b;
  if (x < 0) x += b;
  y = (c - a * x) / b;
  return val;
}
void move(long long dist, long long &y) {
  y += dist;
  y %= 2 * m;
}
long long solve(long long dist) {
  long long x1, y1;
  long long ans = diophantine(n, m, dist, x1, y1);
  return x1;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long x1, y1;
  cin >> n >> m >> x >> y >> vx >> vy;
  if (vy == 0) {
    if (y != 0 && y != m)
      cout << -1;
    else if (vx == 1)
      cout << n << " " << y;
    else
      cout << 0 << " " << y;
  } else if (vx == 0) {
    if (x != 0 && x != n) {
      cout << -1;
    } else if (vy == 1)
      cout << x << " " << m;
    else
      cout << x << " " << 0;
  } else {
    if (vy == -1) y = 2 * m - y;
    if (vx == -1) {
      move(x, y);
      x = 0;
      vx = 1;
      if (y == 0 || y == m || y == 2 * m) {
        if (y > m) y = 2 * m - y;
        cout << x << " " << y;
        return 0;
      }
      long long dist = (m - (y % m)) % m;
      long long y1 = solve(dist);
      long long y2 = solve(dist + m);
      if (y1 == -1 && y2 == -1) {
        cout << -1;
      } else {
        if (y1 == -1)
          y1 = y2;
        else if (y2 != -1)
          y1 = min(y1, y2);
        y += y1 * n;
        y %= 2 * m;
        if (y1 % 2) x = n;
        cout << x << " " << y;
      }
    } else {
      move(n - x, y);
      x = n;
      vx = -1;
      long long cnt = 0;
      long long dist = (m - (y % m)) % m;
      long long y1 = solve(dist);
      long long y2 = solve(dist + m);
      if (y == 0 || y == m || y == 2 * m) {
        if (y > m) y = 2 * m - y;
        cout << x << " " << y;
        return 0;
      }
      if (y1 == -1 && y2 == -1) {
        cout << -1;
      } else {
        if (y1 == -1)
          y1 = y2;
        else if (y2 != -1)
          y1 = min(y1, y2);
        y += y1 * n;
        y %= 2 * m;
        if (y1 % 2) x = 0;
        cout << x << " " << y;
      }
    }
  }
  return 0;
}
