#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, vx, vy, tx, ty;
long long gcd(long long u, long long v) {
  if (v == 0) return u;
  return gcd(v, u % v);
}
pair<long long, long long> exgcd(long long u, long long v) {
  if (v == 0) return make_pair(1, 0);
  pair<long long, long long> o = exgcd(v, u % v);
  return make_pair(o.second, o.first - u / v * o.second);
}
int main() {
  scanf("%lld%lld%lld%lld%lld%lld", &n, &m, &x, &y, &vx, &vy);
  if (vx == vy && vx == 0) {
    printf("-1");
    return 0;
  }
  if (vx == 0) {
    if (x != 0 && x != n)
      printf("-1");
    else
      printf("%lld %lld", x, vy == 1 ? m : 0);
    return 0;
  }
  if (vy == 0) {
    if (y != 0 && y != m)
      printf("-1");
    else
      printf("%lld %lld", vx == 1 ? n : 0, y);
    return 0;
  }
  if (vx == -1) {
    vx = 1;
    tx = 1;
    x = n - x;
  }
  if (vy == -1) {
    vy = 1;
    ty = 1;
    y = m - y;
  }
  if ((x - y) % gcd(n, m) != 0) {
    printf("-1");
    return 0;
  }
  pair<long long, long long> ans = exgcd(n, -m);
  long long _ = m / gcd(n, m);
  ans.first *= (x - y) / gcd(n, m);
  ans.second *= (x - y) / gcd(n, m);
  if (x - y != ans.first * n - ans.second * m) {
    ans.first *= -1;
    ans.second *= -1;
  }
  ans.first = ((ans.first + _ - 1) % _ + _) % _ + 1;
  ans.second = (ans.first * n - x + y) / m;
  printf("%lld %lld", (ans.first % 2 ^ tx) ? n : 0,
         (ans.second % 2 ^ ty) ? m : 0);
}
