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.*;
import java.util.*;
import java.math.*;
import java.lang.*;
 
import static java.lang.Math.*;

public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }
        
        public int read() {
            if (numChars==-1) 
                throw new InputMismatchException();
            
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }
                
                if(numChars <= 0)               
                    return -1;
            }
            return buf[curChar++];
        }
     
        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();
            
            while(isSpaceChar(c)) 
                c = read();
            
            int sgn = 1;
            
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            
            int res = 0;
            do {
                if(c<'0'||c>'9') 
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c)); 
            
            return res * sgn;
        }
        
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }
        
        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        
        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } 
            while (!isSpaceChar(c));
            
            return res.toString();
        }
     
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
     
        public String next() {
            return readString();
        }
        
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(),"Main",1<<26).start();
    }
    long gcd(long a, long b, long vx, long vy) {
        if(a == 0) {
            p = 0;
            q = -vx;
            return b;
        }
        long val = gcd(b % a, a, vx, vy);
        long temp = q;
        q = -p * vy / vx;
        p = -(temp * vx + p * vy * (b / a)) / vy;
        return val;
    }
    long p, q;
    public void run() {
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        
        long n = sc.nextLong();
        long m = sc.nextLong();

        long x = sc.nextLong();
        long y = sc.nextLong();

        long vx = sc.nextLong();
        long vy = sc.nextLong();

        if(vx == 0) {
            if(x == 0 || x == n) {
                if(vy == 1)
                    w.print(x + " " + m);
                else
                    w.print(x + " " + 0);
            }
            else {
                w.print("-1");
            }
            w.close();
            return;
        }
        if(vy == 0) {
            if(y == 0 || y == m) {
                if(vx == 1)
                    w.print(n + " " + y);
                else
                    w.print(0 + " " + y);
            }
            else
                w.print("-1");
            w.close();
            return;
        }

        long c = vy * x - vx * y;
        long gcdnm = gcd(n, m, vx, vy);

        if(c % gcdnm != 0) {
            w.print("-1");
            w.close();
            return;
        }

        p *= c / gcdnm;
        q *= c / gcdnm;

        if(vx == 1) {
            if(p < 0) {
                long reqInc = (-p) / (m / gcdnm) + 1L;
                p += reqInc * m / gcdnm;
                q += vy * reqInc * n / gcdnm;
            }
            else {
                long reqDec = p / (m / gcdnm);
                p -= reqDec * m / gcdnm;
                q -= vy * reqDec * n / gcdnm;
                if(p == 0) {
                    p += m / gcdnm;
                    q += vy * n / gcdnm;
                }
            }
        }
        else {
            if(p > 0) {
                long reqDec = (p - 1) / (m / gcdnm) + 1L;
                p -= reqDec * m / gcdnm;
                q += vy * reqDec * n / gcdnm;
            }
            else {
                long reqInc = (-p) / (m / gcdnm);
                p += reqInc * m / gcdnm;
                q -= vy * reqInc * n / gcdnm;
            }
        }

        long steps = (m * q - y) / vy;
        long steps2 = (n * p - x) / vx;

        long ansx = n, ansy = m;
        if(p % 2 == 0)
            ansx = 0;
        if(q % 2 == 0)
            ansy = 0;

        w.print(ansx + " " + ansy);

        w.close();     
    }
}