#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, vx, vy, c[2][2];
long long minn = 0x3f3f3f3f3f3f3f3fll, k = -1;
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 gcd = exgcd(b, a % b, y, x);
  y -= a / b * x;
  return gcd;
}
long long solve(long long x, long long y) {
  long long m1 = n * 2, m2 = m * 2;
  long long xx, yy, c = y - x;
  long long gcd = exgcd(m1, m2, xx, yy);
  if (c % gcd) return minn;
  return m1 * (((c / gcd * xx) % (m2 / gcd) + m2 / gcd) % (m2 / gcd)) + m1;
}
int main() {
  scanf("%lld%lld%lld%lld%lld%lld", &n, &m, &x, &y, &vx, &vy);
  if (vx == 0) {
    if (x == 0 && vy == -1)
      printf("%lld %lld\n", 0ll, 0ll);
    else if (x == 0 && vy == 1)
      printf("%lld %lld\n", 0ll, m);
    else if (x == n && vy == -1)
      printf("%lld %lld\n", n, 0ll);
    else if (x == n && vy == 1)
      printf("%lld %lld\n", n, m);
    else
      printf("-1\n");
    return 0;
  }
  if (vy == 0) {
    if (y == 0 && vx == -1)
      printf("%lld %lld\n", 0ll, 0ll);
    else if (y == 0 && vx == 1)
      printf("%lld %lld\n", n, 0ll);
    else if (y == m && vx == -1)
      printf("%lld %lld\n", 0ll, m);
    else if (y == m && vx == 1)
      printf("%lld %lld\n", n, m);
    else
      printf("-1\n");
    return 0;
  }
  if (vx == -1)
    c[0][0] = x, c[0][1] = x + n;
  else
    c[0][0] = n + n - x, c[0][1] = n - x;
  if (vy == -1)
    c[1][0] = y, c[1][1] = y + m;
  else
    c[1][0] = m + m - y, c[1][1] = m - y;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      long long res = solve(c[0][i], c[1][j]);
      if (res < minn) minn = res, k = i * 2 + j;
    }
  }
  if (k == -1) printf("-1\n");
  if (k == 0) printf("%lld %lld\n", 0ll, 0ll);
  if (k == 1) printf("%lld %lld\n", 0ll, m);
  if (k == 2) printf("%lld %lld\n", n, 0ll);
  if (k == 3) printf("%lld %lld\n", n, m);
}
