#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, vx, vy;
long long X, Y;
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long exgcd(long long a, long long b, long long &x, long long &y) {
  if (!b) {
    x = 1, y = 0;
    return a;
  }
  long long d = exgcd(b, a % b, y, x);
  y -= (a / b) * x;
  return d;
}
int main() {
  cin >> n >> m >> x >> y >> vx >> vy;
  if (vx == 0 && vy == 0) return puts("-1"), 0;
  if (vx == 0) {
    if (x == 0) {
      if (vy == 1)
        printf("0 %lld\n", m);
      else
        puts("0 0");
    } else if (x == n) {
      if (vy == 1)
        printf("%lld %lld\n", n, m);
      else if (vy == -1)
        printf("%lld 0\n", n);
    } else
      puts("-1");
    return 0;
  } else if (vy == 0) {
    if (y == 0) {
      if (vx == -1)
        printf("0 0\n");
      else
        printf("%lld 0\n", n);
    } else if (y == m) {
      if (vx == -1)
        printf("0 %lld\n", m);
      else
        printf("%lld %lld\n", n, m);
    } else
      puts("-1");
    return 0;
  }
  if (vx == 1 && vy == 1) {
    X = n - x, Y = m - y;
  } else if (vx == 1 && vy == -1) {
    X = n - x, Y = y;
  } else if (vx == -1 && vy == 1) {
    X = x, Y = m - y;
  } else {
    X = x, Y = y;
  }
  long long a, b, d = exgcd(n, m, a, b);
  if ((Y - X) % d) {
    return puts("-1"), 0;
  }
  a *= (Y - X) / d;
  b *= (Y - X) / d;
  if (a < 0) {
    long long p = m / d, q = n / d;
    a += (-a + 1) / p * p;
    if (a < 0) a += p;
    b = (Y - X - n * a) / m;
  }
  if (a > 0) {
    long long p = m / d, q = n / d;
    a %= p;
    b = (Y - X - n * a) / m;
  }
  b = abs(b);
  a %= 2, b %= 2;
  if (a) vx = -vx;
  if (b) vy = -vy;
  if (vx == 1 && vy == 1) printf("%lld %lld\n", n, m);
  if (vx == 1 && vy == -1) printf("%lld 0\n", n);
  if (vx == -1 && vy == 1) printf("0 %lld\n", m);
  if (vx == -1 && vy == -1) printf("0 0\n");
  return 0;
}
