#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void extEuclid(long long a, long long b, long long &x, long long &y,
               long long c) {
  if (b == 0) {
    x = c;
    y = 0;
    return;
  }
  extEuclid(b, a % b, y, x, c);
  y -= (a / b) * x;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  ;
  long long n, m, x, y, vx, vy;
  cin >> n >> m >> x >> y >> vx >> vy;
  if (vx == 0) {
    if (x == 0 || x == n)
      cout << x << " " << (vy == 1) * m;
    else
      cout << -1;
    return 0;
  }
  if (vy == 0) {
    if (y == 0 || y == m)
      cout << (vx == 1) * n << " " << y;
    else
      cout << -1;
    return 0;
  }
  long long c;
  long long x_i = x % n, y_i = y % m;
  if (vx == 1) x_i = (n - x) % n;
  if (vy == 1) y_i = (m - y) % m;
  c = x_i - y_i;
  long long g = gcd(n, m);
  if (c % g != 0) {
    cout << -1;
    return 0;
  }
  long long xx, yy;
  extEuclid(n, m, xx, yy, -c / g);
  long long lcm = n / g * m;
  xx %= (m / g);
  long long t = x_i + n * xx;
  t = (t % lcm + lcm) % lcm;
  x += t * vx;
  y += t * vy;
  long long nn = n + n, mm = m + m;
  cout << (x % nn + nn) % nn << " " << (y % mm + mm) % mm;
  return 0;
}
