시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 79 | 26 | 22 | 42.308% |
Little Vlad has two favorite numbers a and b. Recently, he was taught in school the division and multiplication operations and he immediately started dividing and multiplying his favorite numbers.
He wrote a and b in his notebook and came up with three cool operations which he wants to perform on his numbers:
After performing every operation he erases his old numbers, replacing them with new ones. He may choose to continue performing operations or to stop.
Since Vlad is small, he wants numbers to be smaller. Thus, he is trying to minimize sum of a and b, but can't handle it on his own. Help him to determine minimum sum that he can obtain by performing these operations and give an example of final a and b with such sum.
Input data contains multiple test cases. The first line of input contains integer t — the number of test cases (1 ≤ t ≤ 500).
Each test case is described by a single line containing integers a and b (1 ≤ a, b ≤ 109) — Vlad's favorite numbers.
For each test case output one line — the pair with the minimum sum that can be obtained by performing operations from the list.
2 4 5 4 6
1 5 2 3
Contest > Russian Code Cup > 2017 > RCC 2017 Elimination Round A번