Under construction

Still being built. Things may change

Greatest Common Divisor and Least Common Multiple

Interview

Time limit1sMemory limit128 MB

Summary
Given two natural numbers up to 10000, output their greatest common divisor and least common multiple.
Level

Easy2 of 10

Topics
Math, Number theory
Solved
No attempts yet

Problem

Write a program that finds the greatest common divisor and least common multiple of two natural numbers.

Input

The first line contains two natural numbers A and B separated by a space. A and B are each at most 10,000.

Output

Print the greatest common divisor of A and B on the first line, and print the least common multiple of A and B on the second line.

Examples1

  1. Example 1

    Input
    24 18
    
    Expected output
    6
    72