PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000039. Ước chung lớn nhất và bội chung nhỏ nhất (GCD and LCM)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Ước chung lớn nhất và bội chung nhỏ nhất (GCD and LCM)

GCD and LCM

Source: CodeChef

Version: Phuoc Hung OJ Extended

Problem Statement

Given two positive integers a,ba,b, compute both their greatest common divisor (GCD) and least common multiple (LCM).

Input

One line contains a,ba,b.

Output

Print the GCD followed by the LCM separated by one space.

Subtasks

  • Subtask 1 (20 points): 1≤a,b≤1001 \le a,b \le 100
  • Subtask 2 (30 points): 1≤a,b≤1051 \le a,b \le 10^{5}
  • Subtask 3 (50 points): 1≤a,b≤1091 \le a,b \le 10^{9}

Examples

Input

12 18

Output

6 36

Explanation

The GCD of 1212 and 1818 is 66 and their LCM is 3636.