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:
/**
 * Created by Aminul on 10/10/2018.
 */

import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class CF982E {
    public static void main(String[] args)throws Exception {
        FastReader in = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        long n  = in.nextInt(), m = in.nextInt();
        long x = in.nextInt(), y = in.nextInt();
        long vx = in.nextInt(), vy = in.nextInt();

        long ansX = -1, ansY = -1, min = Long.MAX_VALUE, tmp;
        if( (tmp = solve(n, m, x, y, vx, vy, 0 , 0)) != -1 && tmp < min) {
            min = tmp;
            ansX = 0; ansY = 0;
        }
        if( (tmp = solve(n, m, x, y, vx, vy, n , 0)) != -1 && tmp < min) {
            min = tmp;
            ansX = n; ansY = 0;
        }
        if( (tmp = solve(n, m, x, y, vx, vy, 0 , m)) != -1 && tmp < min) {
            min = tmp;
            ansX = 0; ansY = m;
        }
        if( (tmp = solve(n, m, x, y, vx, vy, n , m)) != -1 && tmp < min) {
            min = tmp;
            ansX = n; ansY = m;
        }

        //debug(min);
        if(ansX == -1) pw.println(-1);
        else pw.println(ansX + " " + ansY);

        pw.close();
    }

    static long solve(long n, long m, long x, long y, long vx, long vy, long tx, long ty) {
        n *= 2 ; m *= 2;
        // (a*vx + x) % n = tx and (a*vy + y) % m = ty; find a

        if(vx == 0) {
            if(x == tx) {
                return mod((ty-y)/vy, m);
            }
            return -1;
        }
        else if(vy == 0) {
            if(y == ty) {
                return mod((tx-x)/vx, n);
            }
            return -1;
        }

        long a = CRT(n, mod((tx-x)/vx, n),  m, mod((ty-y)/vy, m));
        debug(tx, ty, a);
        return a;
    }

    public static long mod(long a, long m) {
        long A =  (a % m);
        return A >= 0 ? A : A + m;
    }

    public static long CRT(long p, long m, long q, long n) {  // x % p = m; x % q = n; finds x
        long a = p, b = q;
        long pp = 1, qq = 0;
        while(b > 0){
            long c = a / b;
            long d;
            d = a; a = b; b = d % b;
            d = pp; pp = qq; qq = d - c * qq;
        }
        if((n - m) % a != 0) return -1; // no solution
        long mod = p / a * q;
        //long ret = (p * pp % mod * ((n - m) / a) + m) % mod; //overflows
        long ret = (mul(mul(p, pp, mod), (n-m)/a, mod)+m)%mod;
        if(ret < 0)ret += mod;
        return ret;
    }
    public static long mul(long a, long b, long mod) {
        a %= mod; if(a < 0)a += mod;
        b %= mod; if(b < 0)b += mod;
        long ret = 0;
        for(int x = 63-Long.numberOfLeadingZeros(b);x >= 0;x--){
            ret += ret;
            if(ret >= mod)ret -= mod;
            if(b<<~x<0){
                ret += a;
                if(ret >= mod)ret -= mod;
            }
        }
        return ret;
    }


    static void debug(Object...obj) {
        System.err.println(Arrays.deepToString(obj));
    }

    static class FastReader {
        InputStream is;
        private byte[] inbuf = new byte[1024];
        private int lenbuf = 0, ptrbuf = 0;

        public FastReader(InputStream is) {
            this.is = is;
        }

        public int readByte() {
            if (lenbuf == -1) throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = is.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0) return -1;
            }
            return inbuf[ptrbuf++];
        }

        public boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }
        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public int skip() {
            int b;
            while ((b = readByte()) != -1 && isSpaceChar(b)) ;
            return b;
        }

        public String next() {
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while (!(isSpaceChar(b))) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }



        public String nextLine() {
            int c = skip();
            StringBuilder sb = new StringBuilder();
            while (!isEndOfLine(c)){
                sb.appendCodePoint(c);
                c = readByte();
            }
            return sb.toString();
        }

        public int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            while (true) {
                if (b >= '0' && b <= '9') {
                    num = (num << 3) + (num << 1) + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        public long nextLong() {
            long num = 0;
            int b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = (num << 3) + (num << 1) + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public char[] next(int n) {
            char[] buf = new char[n];
            int b = skip(), p = 0;
            while (p < n && !(isSpaceChar(b))) {
                buf[p++] = (char) b;
                b = readByte();
            }
            return n == p ? buf : Arrays.copyOf(buf, p);
        }

        public char readChar() {
            return (char) skip();
        }
    }
}