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.util.*;
import java.io.*;

// Solution

public class Main 
{    
  public static void main (String[] argv) 
  {
	  new Main();
  } 
    
  
  
  boolean test = false;
  
  public Main() {
	  FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
	  //FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
      long n = in.nextInt();
      long m = in.nextInt();
      
      int x = in.nextInt();
      int y = in.nextInt();
      int vx = in.nextInt();
      int vy = in.nextInt();
      
      if (vx == 0) {
          if (x == 0 || x == n) {
              if (vy == 1) System.out.println(x + " " + m);
              else System.out.println(x + " 0");
          }else 
            System.out.println(-1);
        return;
      }else if (vy == 0) {
          if (y == 0 || y == m) {
              if (vx == 1)
                System.out.println(n + " " + y);
              else 
                System.out.println(0 + " " + y);
          }else 
              System.out.println(-1);         
          return;          
      }
      
      long g = gcd(n, m);
      long s = 0;
      if (vx > 0) {
          if (vy > 0) {
              s = x - y;
              
              if (n - x == m - y) {
                 System.out.println(n + " " + m);
                  return;  
              }
          }else {
              s = x + y;
              
              if (s == n) {
                  System.out.println(n + " " + 0);
                  return;
              }
          }          
      }else {
          if (vy > 0) {
              s = -(x + y);
              
              if (x == m - y) {
                   System.out.println(0 + " " + m);
                  return;
              }
          }else {
              s = -(x - y);
              if (s == 0) {
                  System.out.println(0 + " " + 0);
                  return;
              }
          }
      }
      
      //now s + k * m = t * n
      // find the minimum k where k > 0
      // if no such k exists, return -1
      if (s % g != 0) {
          System.out.println(-1);    
          return;
      }
      
      long m0 = m, n0 = n;
      
      s /= g;
      m /= g;
      n /= g;
      
      // with that k, find t, if (k % 2 == 1) upper pockages
      //                      if (t % 2 == 1) right pockages
      
      extended_gcd(m, n);
      // a * m + b * n = 1
      
      a *= s;
      b *= s;
      
      // a * m + b * n = s
      

      
      // a * m + b * n = s
      // s - a * m = b * n
      // s + (r * n - a) * m = (b + r * m) * n      
      // find min r such that r * n - a >= 0
      
      long r = 0;
      if (a >= 0) {
          r = a / n + 1;          
      }else {
          r = a / n;    
          if(a % n == 0) ++r;          
      }
      
      long k = r * n - a;
      long t = (s + k * m) / n;
      if(test)System.out.println("m = " + m + ", n = " + n + ", a = " + a + " b = " + b + " s = " + s + " k = " + k + ", t = " + t + ", r = " + r);
      
      if (k % 2 == 0) {
          if (t % 2 == 0) System.out.println("0 0");
          else System.out.println(n0 + " 0");
      }else {
          if (t % 2 == 0) System.out.println("0 " + m0);
          else System.out.println(n0 + " " + m0);          
      }
          
  }
  
  long mod = 1000000007;
  private long gcd(long x, long y) {
      if (y == 0) return x;
      return gcd(y, x % y);
  }
  
  long a = 1, b = 1;
  private long inv(long x) {
      extended_gcd(x, mod);
      return (a % mod + mod) % mod;
  }
  
  private void extended_gcd(long x, long y) {
      if (y == 0) {
          a = 1;
          b = 0;
          return;
      }
      
      long q = x / y;
      long r = x - q * y;
      extended_gcd(y, r);
      long tmp_b = b;
      long tmp_a = a;
      a = tmp_b;
      b = tmp_a - a * q;
  }
  
  
  static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader(BufferedReader in)
        {            
            br = in;
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    String line = br.readLine();
                    if (line == null || line.length() == 0) return "";
                    st = new StringTokenizer(line);
                }
                catch (IOException  e)
                {
                    return "";
                    //e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                return "";
                //e.printStackTrace();
            }
            return str;
        }
    }
}