#include <bits/stdc++.h>
template <typename Tp>
inline void read(Tp &x) {
  x = 0;
  bool f = true;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar()) f ^= ch == '-';
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + (ch ^ 48);
  x = f ? x : -x;
}
int exgcd(int a, int b, long long &x, long long &y) {
  if (!b) {
    x = 1, y = 0;
    return a;
  }
  int d = exgcd(b, a % b, x, y);
  long long z = x;
  x = y, y = z - (a / b) * x;
  return d;
}
int main() {
  int n, m, x, y, vx, vy;
  read(n), read(m), read(x), read(y), read(vx), read(vy);
  if (!vx) {
    if (x && x < n) return printf("-1\n"), 0;
    if (vy == 1)
      printf("%d %d\n", x, m);
    else
      printf("%d %d\n", x, 0);
    return 0;
  }
  if (!vy) {
    if (y && y < m) return printf("-1\n"), 0;
    if (vx == 1)
      printf("%d %d\n", n, y);
    else
      printf("%d %d\n", 0, y);
    return 0;
  }
  int c;
  if (vx == vy)
    c = (y + n - x) % n;
  else
    c = (x + y) % n;
  long long a, b;
  int d = exgcd(m, n, a, b);
  if (c % d) return printf("-1\n"), 0;
  a = (a % (n / d) + n / d) % (n / d);
  a = a * (c / d) % (n / d);
  long long dx = 1LL * a * m - y;
  if (vy == 1 && dx < 0) dx += 1LL * (n / d) * m;
  if (vy == -1) {
    if (dx > 0) dx -= 1LL * (n / d) * m;
    dx = -dx;
  }
  int X = (x + vx * dx) / n, Y = (y + vy * dx) / m;
  printf("%d %d\n", (X & 1) ? n : 0, (Y & 1) ? m : 0);
  return 0;
}
