#B3634. Compute GCD and LCM of Two Numbers

    ID: 11293 Type: Default 1000ms 256MiB

Compute GCD and LCM of Two Numbers

Compute GCD and LCM of Two Numbers

Given two positive integers a and b, compute their greatest common divisor (gcd) and least common multiple (lcm). The formulas used are:

\( gcd(a,b) \) is the greatest common divisor of a and b.

\( lcm(a,b) = \frac{a \times b}{gcd(a,b)} \) is the least common multiple of a and b.

Both integers are within the range of a 32-bit integer.

inputFormat

The input consists of a single line with two space-separated positive integers a and b.

outputFormat

Output two integers separated by a space. The first is the gcd of the two numbers, and the second is the lcm.

sample

6 8
2 24