Problem: Consider a [billiard table](https://en.wikipedia.org/wiki/Billiard_table) of rectangular size n × m with four pockets. Let's introduce a coordinate system with the origin at the lower left corner (see the picture). 

<image>

There is one ball at the point (x, y) currently. Max comes to the table and strikes the ball. The ball starts moving along a line that is parallel to one of the axes or that makes a 45^{\circ} angle with them. We will assume that: 

  1. the angles between the directions of the ball before and after a collision with a side are equal, 
  2. the ball moves indefinitely long, it only stops when it falls into a pocket, 
  3. the ball can be considered as a point, it falls into a pocket if and only if its coordinates coincide with one of the pockets, 
  4. initially the ball is not in a pocket. 



Note that the ball can move along some side, in this case the ball will just fall into the pocket at the end of the side.

Your task is to determine whether the ball will fall into a pocket eventually, and if yes, which of the four pockets it will be.

Input

The only line contains 6 integers n, m, x, y, v_x, v_y (1 ≤ n, m ≤ 10^9, 0 ≤ x ≤ n; 0 ≤ y ≤ m; -1 ≤ v_x, v_y ≤ 1; (v_x, v_y) ≠ (0, 0)) — the width of the table, the length of the table, the x-coordinate of the initial position of the ball, the y-coordinate of the initial position of the ball, the x-component of its initial speed and the y-component of its initial speed, respectively. It is guaranteed that the ball is not initially in a pocket.

Output

Print the coordinates of the pocket the ball will fall into, or -1 if the ball will move indefinitely.

Examples

Input

4 3 2 2 -1 1


Output

0 0

Input

4 4 2 0 1 1


Output

-1

Input

10 10 10 1 -1 0


Output

-1

Note

The first sample: 

<image>

The second sample: 

<image>

In the third sample the ball will never change its y coordinate, so the ball will never fall into a pocket.

Solution (in JAVA):

Solution:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

/*
6
 3  2  0  0  0 -1
 2  3  6  1  5  4
5 2 1 4 6 3
 */
/**
 *
 * @author Andy Phan
 */
public class e {
    public static void main(String[] args) {
        FS in = new FS(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        int y = in.nextInt();
        int vx = in.nextInt();
        int vy = in.nextInt();
        if(vx == 0 && vy == 1) {
            if(x == 0) print(0, m);
            else if(x == n) print(n, m);
            else print(-1, -1);
            return;
        }
        if(vx == 0 && vy == -1) {
            if(x == 0) print(0, 0);
            else if(x == n) print(n, 0);
            else print(-1, -1);
            return;
        }
        if(vx == 1 && vy == 0) {
            if(y == 0) print(n, 0);
            else if(y == m) print(n, m);
            else print(-1, -1);
            return;
        }
        if(vx == -1 && vy == 0) {
            if(y == 0) print(0, 0);
            else if(y == m) print(0, m);
            else print(-1, -1);
            return;
        }
        
        long xi = vx == 1 ? n-x : x;
        long yi = vy == 1 ? m-y : y;
        
        long[] res = eq(n, m, yi-xi);
        if(res[0] == -1) {
            System.out.println(-1);
            return;
        }
        print(n*((res[0]&1)^((vx+1)/2)), m*((res[1]&1)^(vy+1)/2));
        out.close();
    }
    
    static void print(long[] arr) {
        print(arr[0], arr[1]);
    }
    
    static void print(long x, long y) {
        if(x == -1) System.out.println(-1);
        else System.out.println(x + " " + y);
    }
    
    static long[] eq(long a, long b, long c) {
        long gcd = gcd(a, b);
        if(c%gcd != 0) return new long[] {-1, -1};
        a /= gcd;
        b /= gcd;
        c /= gcd;
        long inv = modInv(b, a);
        long y = ((inv*-c)%a+a)%a;
        long x = (b*y+c)/a;
        if(x >= 0) return new long[] {x, y};
        long diff = (-x+b-1)/b;
        return new long[] {x+diff*b, y+diff*a};
    }
    
    static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a%b);
    }
    
    // Computes the modular inverse of x
    // Returns 0 if the GCD of x and mod is not 1
    // O(log n)  :  Can be converted to use BigIntegers
    static long modInv(long x, long mod) {
        if(x == 1) return 1;
        if(gcd(x, mod) != 1) return 0;
        long r = mod % x;
        return modInv(r, x % r, 0, 1, mod / x, x / r);
    }

    static long modInv(long a, long b, long y0, long y1, long q0, long q1) {
        long y2 = y0 - y1*q0;
        return b == 0 ? y2 : modInv(b, a % b, y1, y2, q1, a / b);
    }
    
    static class FS {

        BufferedReader in;
        StringTokenizer token;
        
        public FS(InputStream str) {
            in = new BufferedReader(new InputStreamReader(str));
        }
        
        public String next() {
            if (token == null || !token.hasMoreElements()) {
                try {
                    token = new StringTokenizer(in.readLine());
                } catch (IOException ex) {
                }
                return next();
            }
            return token.nextToken();
        }
        
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}