#P2406. Minimal GCD-LCM Pair Sum
Minimal GCD-LCM Pair Sum
Minimal GCD-LCM Pair Sum
Given two positive integers \(a\) and \(b\) with \(a \le b\), find two integers \(x\) and \(y\) (with \(x \le y\)) such that:
- \(\gcd(x,y) = a\)
- \(\mathrm{lcm}(x,y) = b\)
- The sum \(x+y\) is minimized among all pairs satisfying the above conditions.
You can assume that \(a\) divides \(b\), so that a solution exists.
inputFormat
The input consists of a single line containing two space-separated positive integers \(a\) and \(b\) (with \(a \le b\)).
outputFormat
Output two space-separated integers \(x\) and \(y\) that satisfy the conditions and minimize \(x+y\).
sample
3 60
12 15