#include <bits/stdc++.h>
using namespace std;
inline 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, x, y);
  long long z = x;
  x = y;
  y = z - a / b * y;
  return d;
}
long long n, m, x, y, vx, vy, X, Y, a, b;
signed main() {
  cin >> n >> m >> x >> y >> vx >> vy;
  if (vx == 0) {
    if (x == 0 || x == n) {
      if (vy == 1)
        cout << x << " " << m << endl;
      else
        cout << x << " " << 0 << endl;
    } else
      cout << -1 << endl;
    return 0;
  }
  if (vy == 0) {
    if (y == 0 || y == m) {
      if (vx == 1)
        cout << n << " " << y << endl;
      else
        cout << 0 << " " << y << endl;
    } else
      cout << -1 << endl;
    return 0;
  }
  if (vx == -1) X = 1, x = n - x;
  if (vy == -1) Y = 1, y = m - y;
  long long gcd = exgcd(n, m, a, b);
  if ((x - y) % gcd) {
    cout << -1 << endl;
    return 0;
  }
  a = a * (x - y) / gcd;
  b = b * (x - y) / gcd;
  long long dx = m / gcd, dy = n / gcd, A = n, B = m;
  long long ansx = (a % dx + dx - 1) % dx + 1, ansy = (ansx * n + y - x) / m;
  if (ansx % 2 == 0) A = n - A;
  if (X) A = n - A;
  if (ansy % 2 == 0) B = m - B;
  if (Y) B = m - B;
  cout << A << " " << B << endl;
  return 0;
}
