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.
from math import floor, ceil
from sys import stdout


def Billiard_Table(n, m, x, y, vx, vy):
    if n - x == m - y:      #the ball falls directly into the top right hole 
        return n, m                   #without bouncing from any side of the table
    
    r = y - x
    
    result = GCD_Euclidean_Algorithm(m, n)  # k1_0 and k2_0 are coefficients by means of which
                                            # we can express the d = gcd as a LC of the arguments
    d = result[0]
    k2_0 = result[1]
    k1_0 = -result[2]
    
    if r % d != 0:
        return -1, "A"    # right side of the Dioph. Eq. is not divisible by the gcd, so there is no solution                                                          
        
    k1_0 = k1_0 * r // d 
    k2_0 = k2_0 * r // d     # now k1_0 and k2_0 are a particular solution of the Dioph. Eq.

    # establishing lower bounds for t
    t_lb1 = (-k1_0 / m) * d
    t_lb2 = (-k2_0 / n)  * d
    t = min(t_lb1, t_lb2)
    if t - floor(t) == 0:
        t += 1
    t = ceil(t)
            
    k1 = k1_0 + t * m // d
    k2 = k2_0 + t * n // d
        
    #by checking the parity of k1 and k2 we can know in which hole the ball fell       
    return (int(k1) % 2) * n, (int(k2) % 2) * m


def GCD_Euclidean_Algorithm(a, b):    
    if a == 0: 
        return b, 0, 1
    d, x1, y1 = GCD_Euclidean_Algorithm(b%a, a)     # x, y, x_1 and y_1 are used to update the 
                                                    # values of the coefficients by substituting the 
    x = y1 - floor(b/a) * x1                        # previously obtained values along with the 
    y = x1                                          # return of the recursive calls
    return d, x, y


def main():
    n, m, x, y, vx, vy = input().split(' ')
    
    n = int(n)
    m = int(m)
    x = int(x)
    y = int(y)
    vx = int(vx)
    vy = int(vy)

    if vx == 0:                 #vertical motion
        if vy == 0:             #the ball is not moving 
            stdout.write(str(-1))           
            return
                        
        if x == 0:              #motion occurs along the left side of the billiard table
                
            if vy > 0:          #motion is vertical upwards
                stdout.write(str(0) + " " + str(m))    #the ball falls in the top left hole
                return
                
            elif vy < 0:        #motion is vertical downwards
                stdout.write(str(0) + " " + str(0))    #the ball falls in the bottom left hole
                return
            
        elif x == m:            #motion occurs along the right side of the billiard table
                
            if vy < 0:          #motion is vertical upwards
                stdout.write(str(n) + " " + str(0))    #the ball falls in the bottom right hole
                return
                
            elif vy > 0:         #motion is vertical downwards
                stdout.write(str(n) + " " + str(m))    #the ball falls in the top right hole
                return
        else: 
            stdout.write(str(-1))   #the ball yeeps bouncing indefinitely between the top and bottom sides
            return
    if vy == 0:                 #horizontal motion
        if y == 0:              #motion occurs along the bottom side of the table
                
            if vx > 0:          #motion is oriented to the right
                stdout.write(str(n) + " " + str(0))    #the ball falls in the bottom right hole
                return
            elif vx < 0:        #motion is oriented to the left
                stdout.write(str(0) + " " + str(0))    #the ball falls in the bottom left hole
                return
        elif y == m:            #motion occurs along the top side of the table
                
            if vx > 0:          #motion is oriented to the right
                stdout.write(str(n) + " " + str(m))     #the ball falls in the top right hole
                return
            elif vx < 0:        #motion is oriented to the left
                stdout.write(str(0) + " " + str(m))     #the ball falls in the top left hole
                return
        else:
            stdout.write(str(-1))         #the ball keeps bouncing indefinitely between the right and left sides
            return
    
    # this is the only version of the problem we actually solve
    if vx == 1 and vy == 1:
        k1, k2 = Billiard_Table(n, m, x, y, vx, vy)
        if k2 == "A":
            stdout.write(str(-1))
            return
        
    # for the other three versions, we reflect and translate the coordinate system,
    # arriving to the same situation as in the first problem
    # after solving, we reflect and translate back to the original coord. system
    elif vx ==1 and vy == -1:
        vy_prime = 1
        y_prime = -y + m
        k1, k2 = Billiard_Table(n, m, x, y_prime, vx, vy_prime)
        if k2 == "A":
            stdout.write(str(-1))
            return
        k2 = -(k2 - m)
        
    elif vx == -1 and vy == 1:
        vx_prime = 1
        x_prime = -x + n
        k1, k2 = Billiard_Table(n, m, x_prime, y, vx_prime, vy)
        if k2 == "A":
            stdout.write(str(-1))
            return
        k1 = -(k1 - n)
        
    else:
        vy_prime = 1
        y_prime = -y + m
        vx_prime = 1
        x_prime = -x + n

        k1, k2 = Billiard_Table(n, m, x_prime, y_prime, vx_prime, vy_prime)
        if k2 == "A":
            stdout.write(str(-1))
            return        
        k1 = -(k1 - n)
        k2 = -(k2 - m)

    stdout.write(str(k1) + " " + str(k2))
    return
main()