#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, mx, my, ansx, ansy;
long long T;
void solve() {
  if (my) {
    if (x == 0) {
      if (my == 1)
        printf("%d %d\n", 0, m);
      else
        printf("%d %d\n", 0, 0);
      return;
    }
    if (x == n) {
      if (my == 1)
        printf("%d %d\n", n, m);
      else
        printf("%d %d\n", n, 0);
      return;
    }
    puts("-1");
    return;
  }
  if (mx) {
    if (y == 0) {
      if (mx == 1)
        printf("%d %d\n", n, 0);
      else
        printf("%d %d\n", 0, 0);
      return;
    }
    if (y == m) {
      if (mx == 1)
        printf("%d %d\n", n, m);
      else
        printf("%d %d\n", 0, m);
      return;
    }
    puts("-1");
    return;
  }
}
long long exgcd(long long &x, long long &y, int a, int b) {
  if (!b) {
    x = 1, y = 0;
    return a;
  }
  long long g = exgcd(x, y, b, a % b);
  long long z = x;
  x = y;
  y = z - a / b * y;
  return g;
}
void Get(int xx, int yy) {
  int ax = 0, ay = 0;
  if (x > xx) {
    if (mx == -1)
      ax = x;
    else
      ax = n + n - x;
  }
  if (x < xx) {
    if (mx == 1)
      ax = n - x;
    else
      ax = n + x;
  }
  if (y > yy) {
    if (my == -1)
      ay = y;
    else
      ay = m + m - y;
  }
  if (y < yy) {
    if (my == 1)
      ay = m - y;
    else
      ay = m + y;
  }
  long long cx, cy, zz = ay - ax;
  long long g = exgcd(cx, cy, n * 2, m * 2);
  g = abs(g);
  if (zz % g) return;
  long long gn = n * 2 / g, gm = m * 2 / g;
  cy = (cy * (zz / g) % gn + gn) % gn;
  if (cy) cy -= gn;
  cx = (zz - cy * m * 2) / (n * 2);
  if (cx < 0) return;
  if (cx * n * 2 + ax < T) {
    T = cx * n * 2 + ax;
    ansx = xx, ansy = yy;
  }
}
int main() {
  scanf("%d%d%d%d%d%d", &n, &m, &x, &y, &mx, &my);
  if (!mx || !my) {
    solve();
    return 0;
  }
  T = 999999999999999999;
  Get(0, 0);
  Get(n, 0);
  Get(0, m);
  Get(n, m);
  if (T == 999999999999999999)
    puts("-1");
  else
    printf("%d %d\n", ansx, ansy);
  return 0;
}
