https://acs.jxnu.edu.cn/contest/22/board/challenge/D
Monitor
描述:
Reca company makes monitors, the most popular of their models is AB999 with the screen size a × b centimeters. (Reca公式研发了监视器,最受欢迎的模型是AB999 其尺寸是a*b cm)
Because of some production peculiarities a screen parameters are integer numbers. (由于一些产品特定的屏幕指数是整数。)
Recently the screen sides ratio x: y became popular with users.(最近 这屏幕尺寸比例 x:y 变得更加受客户的欢迎。)
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. (那就是公式想要重塑AB999尺寸的理由,从而让它的尺寸比例变成x:y,同时他们想要让它的总面积尽可能达到最大。)
Your task is to find the screen parameters of the reduced size model, or find out that such a reduction can't be performed.
(你的任务就是去找到重新塑造的模型尺寸,或者判断其不能被重新塑造。)
输入:
The first line of the input contains 4 integers — a, b, x and 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)