题目地址:Login | JXNUOJ
Monitor
显示屏
描述:
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.
Reca公司生产显示屏,最受欢迎的型号是AB999,屏幕尺寸为a × b厘米。因为一些产品的特性,屏幕的参数是整数。最近屏幕大小比率x:y开始受用户欢迎。这就是公司想要去减少显示屏AB999的大小以至于它的屏幕的大小的比率为x:y。同时他们想他的总面积去成为所有可能的变体的最大值。你的任务是找到缩小尺寸模型的屏幕参数,或者找出这样的缩小不能执行。
输入:
The first line of the input contains 4 integers — a, b, x and y (1 ≤ a, b, x, y ≤ 2·109).
第一行输入四个整数— a, b, x 和 y (1 ≤ a, b, x, y ≤ 2·109).
输出:
If the answer exists, output 2 positive integers — screen parameters of the reduced size model. Output 0 0 otherwise.
如果答案存在,输出两个正整数——缩小尺寸模型的屏幕参数
否则输出0 0
样例输入:
800 600 4 3
复制
样例输出:
800 600