#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, vx, vy, flx, fly, resx, resy;
long long ex_gcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long d = ex_gcd(b, a % b, x, y);
  long long temp = x;
  x = y;
  y = temp - a / b * y;
  return d;
}
bool work(long long a, long long b, long long c, long long &x, long long &y) {
  long long d = ex_gcd(a, b, x, y);
  if (c % d != 0) return 0;
  long long k = c / d;
  x *= k;
  y *= k;
  d = fabs(d);
  long long t = b / d;
  x = (x % t + t) % t;
  y = (c - a * x) / b;
  if (x < 0 || y < 0) return 0;
  return 1;
}
signed main() {
  scanf("%lld%lld%lld%lld%lld%lld", &n, &m, &x, &y, &vx, &vy);
  if (vx * vy == 0) {
    if (x > 0 && y > 0 && x < n && y < m) {
      cout << -1 << endl;
    } else {
      if (vy == 1 && !x || vx == -1 && y == m)
        cout << "0 " << m << endl;
      else if (vy == -1 && !x || vx == -1 && y == 0)
        cout << "0 0" << endl;
      else if (vx == 1 && !y || vy == -1 && x == n)
        cout << n << " 0" << endl;
      else if (vy == 1 && x == n || vx == 1 && y == m)
        cout << n << ' ' << m << endl;
      else
        cout << -1 << endl;
    }
    return 0;
  }
  if (vx == -1) flx = 1, x = n - x;
  if (vy == -1) fly = 1, y = m - y;
  long long c = x - y, xx, yy, b = m;
  long long d = ex_gcd(n, b, xx, yy);
  if (c % d != 0) {
    puts("-1");
    return 0;
  }
  b /= d;
  long long k = c / d;
  b = abs(b);
  xx = xx * k;
  xx = (xx % b + b) % b;
  if (xx <= 0) xx += b;
  yy = -(c - xx * n) / m;
  if (xx % 2) resx = n;
  if (yy % 2) resy = m;
  cout << (flx ? n - resx : resx) << " " << (fly ? m - resy : resy);
  return 0;
}
