Greatest Common Divisor and Least Common Multiple
Submit solution
Points:
100
Time limit:
1.0s
Memory limit:
256M
Author:
Problem types
Allowed languages
Python
Given two positive integers \(a\) and \(b\), compute their greatest common divisor \(\gcd(a,b)\) and least common multiple \(\operatorname{lcm}(a,b)\).
Input
One line containing a and b.
The input satisfies:
- \(1 \le a, b \le 10^12\)
- The least common multiple fits in a signed 64-bit integer.
Output
Print \(\gcd(a,b)\) on the first line and \(\operatorname{lcm}(a,b)\) on the second line.
Example
Input
12 18
Output
6
36
Comments