题目描述
Chef was bored staying at home in the lockdown. He wanted to go out for a change. Chef and Chefu are fond of eating Cakes,so they decided to go the Cake shop where cakes of all possible price are available .
They decided to purchase cakes of equal price and each of them will pay for their cakes. Chef only has coins of denomination $N$ whereas Chefu has that of denomination $M$.
So they want your help to find out the minimum amount to be spent in order to purchase the cakes.
-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input, two integers $N, M$.
-----Output:-----
For each testcase, output in a single line answer the minimum amount to be spent in order to purchase the cake.
-----Constraints-----
- $1 \leq T \leq 1000$
- $2 \leq N,M \leq 10^7$
-----Sample Input:-----
1
2 3
-----Sample Output:-----
6
输入格式
见题面
输出格式
见题面