#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Read(T &n) {
  char ch;
  bool flag = false;
  while (!isdigit(ch = getchar()))
    if (ch == '-') flag = true;
  for (n = ch ^ 48; isdigit(ch = getchar());
       n = (n << 1) + (n << 3) + (ch ^ 48))
    ;
  if (flag) n = -n;
}
long long n, m, x, y, dx, dy;
char ansx, ansy;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
void exgcd(long long a, long long b, long long &x, long long &y) {
  if (!b) return x = 1, y = 0, void();
  exgcd(b, a % b, x, y);
  swap(x, y);
  y = y - a / b * x;
}
int main() {
  Read(n);
  Read(m);
  Read(x);
  Read(y);
  Read(dx);
  Read(dy);
  if (dx == 0)
    return x == 0 or x == n ? printf("%lld %lld\n", x, dy == 1 ? m : 0)
                            : puts("-1"),
           0;
  if (dy == 0)
    return y == 0 or y == m ? printf("%lld %lld\n", dx == 1 ? n : 0, y)
                            : puts("-1"),
           0;
  if (dx == -1) ansx = 1, x = n - x;
  if (dy == -1) ansy = 1, y = m - y;
  long long g = gcd(n, m);
  if ((x - y) % g) return puts("-1"), 0;
  long long a = n / g, b = m / g, c = (x - y) / g, tx, ty;
  exgcd(a, b, tx, ty);
  tx *= c;
  tx = tx + ((x + n - 1) / n - tx + b - 1) / b * b;
  ty = (tx * n - x + y) / m;
  while ((tx - b) * n >= x and (ty - a) * m >= y) tx -= b, ty -= a;
  printf("%lld %lld\n", tx & 1 ^ ansx ? n : 0, ty & 1 ^ ansy ? m : 0);
  return 0;
}
