#include <bits/stdc++.h>
using namespace std;
long long x2, y2;
long long euler(long long a, long long b) {
  if (b == 0) {
    x2 = 1;
    y2 = 0;
    return a;
  } else {
    long long res = euler(b, a % b);
    long long temp = x2;
    x2 = y2;
    y2 = temp - (a / b) * y2;
    return res;
  }
}
int main() {
  int T;
  long long x, y, m, n, vx, vy;
  long long k1, k2;
  long long res, res1, res2, xx, yy;
  cin >> n >> m >> x >> y >> vx >> vy;
  if (!vx) {
    if ((!x) || (x == n)) {
      cout << x << " " << (vy > 0 ? m : 0) << endl;
    } else
      cout << "-1" << endl;
    return 0;
  }
  if (!vy) {
    if ((!y) || (y == m)) {
      cout << (vx > 0 ? n : 0) << " " << y << endl;
    } else
      cout << "-1" << endl;
    return 0;
  }
  k1 = (vx == 1 ? ((n - x) % n) : (x % n));
  k2 = (vy == 1 ? ((m - y) % m) : (y % m));
  long long g = euler(n, m);
  if (abs(k1 - k2) % g) {
    cout << "-1" << endl;
    return 0;
  }
  long long lcm = m * n / g;
  res1 = (k2 * x2) % m;
  res1 = res1 * (n / g);
  res2 = (k1 * y2) % n;
  res2 = res2 * (m / g);
  res = (res1 + res2) % lcm;
  res = (res + lcm) % lcm;
  xx = x + res * vx;
  yy = y + res * vy;
  cout << ((xx % (2 * n)) + 2 * n) % (2 * n) << " "
       << ((yy % (2 * m)) + 2 * m) % (2 * m) << endl;
  return 0;
}
