There is a tale about the wise King Keykhosrow who owned a grand treasury filled with treasures from across the Persian Empire. However, to prevent theft and ensure the safety of his wealth, King Keykhosrow's vault was sealed with a magical lock that could only be opened by solving a riddle.
The riddle involves two sacred numbers a and b. To unlock the vault, the challenger must determine the smallest key number m that satisfies two conditions:
Only by finding the smallest correct value of m can one unlock the vault and access the legendary treasures!
The first line of the input contains an integer t (1≤t≤100), the number of test cases.
Each test case consists of a single line containing two integers a and b (1≤a,b≤1000).
For each test case, print the smallest integer m that satisfies the conditions above.
24 6472 896
12 52864
In the first test case, you can see that:
Name |
---|