Problem: Reca company makes monitors, the most popular of their models is AB999 with the screen size a × b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popular with users. That's why the company wants to reduce monitor AB999 size so that its screen sides ratio becomes x: y, at the same time they want its total area to be maximal of all possible variants. Your task is to find the screen parameters of the reduced size model, or find out that such a reduction can't be performed.

Input

The first line of the input contains 4 integers — a, b, x and y (1 ≤ a, b, x, y ≤ 2·109).

Output

If the answer exists, output 2 positive integers — screen parameters of the reduced size model. Output 0 0 otherwise.

Examples

Input

800 600 4 3


Output

800 600


Input

1920 1200 16 9


Output

1920 1080


Input

1 1 1 2


Output

0 0

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;

public class Main {
 
	public static void main(String[] args) throws IOException,InterruptedException{
		Scanner sc=new Scanner(System.in);
        long x=sc.nextLong(),y=sc.nextLong(),a=sc.nextLong(),b=sc.nextLong();
        primes();
        long gcd=gcd(a,b);
        a/=gcd;
        b/=gcd;
        solve(x,y,a,b);
        pw.println(r1+" "+r2);
        pw.close();
    }
	static HashSet<Long> hs;
	static long r1=0,r2=0;
	static PrintWriter pw=new PrintWriter(System.out);
	static void solve(long x,long y,long a,long b) {
		long start=0,end=x;
		while(start<=end) {
			long mid=(start+end)/2;
			if (a*mid>x||b*mid>y) {
				end = mid - 1;
			}else {
				r1=a*mid;
				r2=b*mid;
				start = mid + 1;
			}
		}
	}
	static long pow(int a,int b) {
		long r=1l;
		for (int i = 0; i < b; i++) {
			r*=a;
		}
		return r;
	}
	
	static void primes() {
		boolean[] freq=new boolean[1000000];
		for (int i = 0; i < freq.length; i++) {
			freq[i]=true;
		}
		hs=new HashSet<>();
		for (int i = 2; i <= 1e3; i++) {
			if(freq[i-1]) {
				for (int j = i*i; j <= 1e6; j+=i) {
					freq[j-1]=false;
				}
			}
		}
		for (int i = 2; i < freq.length; i++) {
			if(freq[i-1]) hs.add((long)(i));
		}
	}
 	
	static long gcd(long x,long y) {
		while (x!=y) {
			if(Math.max(x,y)/Math.min(x,y)==(double)(Math.max(x,y))/Math.min(x,y)) return Math.min(x,y);
			if(hs.contains(x)) {
				if(y/x==y/(double)x) return x;
				else return 1;
			}else if (hs.contains(y)) {
				if(x/y==x/(double)y) return y;
				else return 1;
			}
			if(x>y) x-=y;
			else y-=x;
		}
		return x;
	}
	static class pair implements Comparable<pair> {
		int x;
		int y;
 
		public pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
 
		public String toString() {
			return x + " " + y;
		}
		public boolean equals(Object o) {
            if (o instanceof pair) {
                pair p = (pair)o;
                return p.x == x && p.y == y;
            }
            return false;
        }
        public int hashCode() {
            return new Double(x).hashCode() * 31 + new Double(y).hashCode();
        }
        public int compareTo(pair other) {
        	if(this.x==other.x) {
        		return Long.compare(this.y, other.y);
        	}
			return Long.compare(this.x, other.x);
		}
	}
 	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
 
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
 
		public boolean hasNext() {
			// TODO Auto-generated method stub
			return false;
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
	}
 
}