#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, x = 0;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = -1LL;
  } while (ch < '0' || ch > '9');
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  return f * x;
}
inline long long readll() {
  long long f = 1, x = 0;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = -1LL;
  } while (ch < '0' || ch > '9');
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  return f * x;
}
template <class T>
inline void chmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void chmin(T &a, T b) {
  if (a > b) a = b;
}
inline void swap(int &a, int &b) {
  int c = a;
  a = b;
  b = c;
}
using namespace std;
int n, m, x, y, vx, vy, flx, fly;
inline int atx(int x) { return x == 0 || x == n; }
inline int aty(int y) { return y == 0 || y == m; }
inline void exgcd(int a, int b, long long &d, long long &x, long long &y) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
    return;
  }
  exgcd(b, a % b, d, y, x);
  y -= (a / b) * x;
}
int main() {
  n = read();
  m = read();
  x = read();
  y = read();
  vx = read();
  vy = read();
  if (atx(x) && aty(y)) {
    printf("%d %d\n", x, y);
    return 0;
  }
  if (vx == 0) {
    if (vy == 0)
      puts("-1");
    else {
      if (atx(x)) {
        printf("%d %d\n", x, (vy == -1) ? 0 : m);
      } else
        puts("-1");
    }
    return 0;
  }
  if (vy == 0) {
    if (vx == 0)
      puts("-1");
    else {
      if (aty(y)) {
        printf("%d %d\n", (vx == -1) ? 0 : n, y);
      } else
        puts("-1");
    }
    return 0;
  }
  if (vx == -1) {
    vx = 1;
    flx = 1;
    x = n - x;
  }
  if (vy == -1) {
    vy = 1;
    fly = 1;
    y = m - y;
  }
  long long a, b, d;
  exgcd(n, m, d, a, b);
  if ((x - y) % d) {
    puts("-1");
    return 0;
  }
  long long t = (x - y) / d;
  a *= t;
  b *= t;
  a = a % (m / d);
  if (a <= 0) a += m / d;
  long long ansx = 1ll * a * n, ansy = ansx + (y - x);
  int retx = n, rety = m;
  if ((ansx / n) % 2 == 0) retx = n - retx;
  if ((ansy / m) % 2 == 0) rety = m - rety;
  if (flx) retx = n - retx;
  if (fly) rety = m - rety;
  printf("%d %d\n", retx, rety);
  return 0;
}
