P28562 [洛谷] Minimum Sum
提高-
题目描述

Problem Background

The RSA algorithm is based on a very simple number theory fact: it is easy to multiply two large prime numbers, but it is extremely difficult to factorize their product. Therefore, the product can be made public as an encryption key. Thus, only short RSA keys are potentially vulnerable to brute force attacks.

Problem Description

Given positive integers $a$ and $b$ where $a \leq b$.

Find $x$ and $y$ that satisfy the conditions and minimize the value of $x + y$.

Conditions:

  • $\gcd(x, y) = a$
  • $\mathrm{lcm}(x, y) = b$
  • $x \leq y$

Input Format

Multiple sets of data, terminated by EOF.

There are at most $10^3$ lines, each containing two numbers $a$ and $b$.

Output Format

Output the same number of lines as the input file, each containing two numbers $x$ and $y$ separated by a half-width space.

Sample Input and Output

Input Sample #1

3 60

Output Sample #1

12 15

Input Sample #2

200 20000
300 30000
400 40000

Output Sample #2

800 5000
1200 7500
1600 10000

Notes

$3 \leq a, b < 2^{63}$.

The input ends with EOF, and there is no line indicating the number of sets $n$; the first line contains the data directly.

The data is generated randomly.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 60
样例输出
12 15