#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
const int INF = 0x3f3f3f3f;
const int inf = 0x7fffffff;
const int mod = 1e9 + 7;
const int MOD = 10007;
int n, m, x, y, vx, vy;
long long exgcd(int a, int b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    long long tmp = exgcd(b, a % b, y, x);
    y -= (a / b) * x;
    return tmp;
  }
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void solve() {
  while (cin >> n >> m >> x >> y >> vx >> vy) {
    if (!vx) {
      if (x == 0 || x == n) {
        if (vy > 0)
          cout << x << " " << m << endl;
        else
          cout << x << " " << 0 << endl;
      } else {
        cout << -1 << endl;
      }
      continue;
    }
    if (!vy) {
      if (y == 0 || y == m) {
        if (vx > 0)
          cout << n << " " << y << endl;
        else
          cout << 0 << " " << y << endl;
      } else {
        cout << -1 << endl;
      }
      continue;
    }
    int rx = 0, ry = 0;
    long long a, b, d = exgcd(n, m, a, b);
    if (vx == -1) {
      rx = 1;
      x = n - x;
    }
    if (vy == -1) {
      ry = 1;
      y = m - y;
    }
    long long k = x - y;
    if (k % d) {
      cout << -1 << endl;
      continue;
    }
    k /= d;
    a *= k;
    b *= k;
    long long _n = n / d, _m = m / d;
    long long _a = (a % _m + _m - 1) % _m + 1, _b = -((x - y) - _a * n) / m;
    long long ansx = n, ansy = m;
    if (_a % 2 == 0) ansx = n - ansx;
    if (_b % 2 == 0) ansy = m - ansy;
    if (rx) ansx = n - ansx;
    if (ry) ansy = m - ansy;
    cout << ansx << " " << ansy << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
