#include <bits/stdc++.h>
using namespace std;
int gcdExtended(int a, int b, long long int *x, long long int *y) {
  if (a == 0) {
    *x = 0;
    *y = 1;
    return b;
  }
  long long int x1, y1;
  int gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
int main() {
  long long int n, m, x, y, vx, vy, bx = 0, by = 0, ex = 0, ey = 0, c;
  cin >> n >> m >> x >> y >> vx >> vy;
  if (abs(vx) + abs(vy) == 1) {
    if (vx) {
      if (vx > 0)
        ex = n;
      else
        ex = 0;
      if (y == 0)
        ey = 0;
      else if (y == m)
        ey = m;
      else {
        cout << -1;
        return 0;
      }
    } else {
      if (vy > 0)
        ey = m;
      else
        ey = 0;
      if (x == 0)
        ex = 0;
      else if (x == n)
        ex = n;
      else {
        cout << -1;
        return 0;
      }
    }
    cout << ex << " " << ey;
    return 0;
  }
  if (vx < 0) {
    x = n - x;
    bx = n;
  }
  if (vy < 0) {
    y = m - y;
    by = m;
  }
  c = x - y;
  long long int a, b;
  int g = gcdExtended(n, m, &a, &b);
  if (abs(c) % g) {
    cout << -1;
    return 0;
  }
  b *= -1;
  a *= c / g;
  b *= c / g;
  n /= g;
  m /= g;
  if (a <= 0) {
    long long int mult = a / m;
    a -= mult * m;
    b -= mult * n;
    if (a <= 0) {
      a += m;
      b += n;
    }
  }
  if (b <= 0) {
    long long int mult = b / n;
    a -= mult * m;
    b -= mult * n;
    if (b <= 0) {
      a += m;
      b += n;
    }
  }
  long long int mult = a / m;
  if (mult > b / n) mult = b / n;
  a -= mult * m;
  b -= mult * n;
  if ((a == 0) || (b == 0)) {
    a += m;
    b += n;
  }
  if (a % 2 == 0)
    ex = bx;
  else
    ex = n * g - bx;
  if (b % 2 == 0)
    ey = by;
  else
    ey = m * g - by;
  cout << ex << " " << ey;
}
