Good Bye 2023
B
Two Divisors
Codeforces
1000
原题
← AC →
翻译中…

A certain number $1 \le x \le 10^9$ is chosen. You are given two integers $a$ and $b$, which are the two largest divisors of the number $x$. At the same time, the condition $1 \le a \lt b \lt x$ is satisfied.

翻译中…

For the given numbers $a$, $b$, you need to find the value of $x$.

翻译中…

$^{\dagger}$ The number $y$ is a divisor of the number $x$ if there is an integer $k$ such that $x = y \cdot k$.

翻译中…

Input

翻译中…

Each test consists of several test cases. The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then follows the description of the test cases.

翻译中…

The only line of each test cases contains two integers $a$, $b$ ($1 \le a \lt b \le 10^9$).

翻译中…

It is guaranteed that $a$, $b$ are the two largest divisors for some number $1 \le x \le 10^9$.

翻译中…

Output

翻译中…

For each test case, output the number $x$, such that $a$ and $b$ are the two largest divisors of the number $x$.

翻译中…

If there are several answers, print any of them.

翻译中…

Note

翻译中…

For the first test case, all divisors less than $6$ are equal to $[1, 2, 3]$, among them the two largest will be $2$ and $3$.

翻译中…

For the third test case, all divisors less than $33$ are equal to $[1, 3, 11]$, among them the two largest will be $3$ and $11$.

翻译中…

For the fifth test case, all divisors less than $20$ are equal to $[1, 2, 4, 5, 10]$, among them the two largest will be $5$ and $10$.

翻译中…

For the sixth test case, all divisors less than $12$ are equal to $[1, 2, 3, 4, 6]$, among them the two largest will be $4$ and $6$.

翻译中…

样例

Input #1
8
2 3
1 2
3 11
1 5
5 10
4 6
3 9
250000000 500000000
Output #1
6
4
33
25
20
12
27
1000000000
InputCopy OutputCopy
题目信息
题号
1916B
所属比赛
时间限制
1 s
内存限制
256 MB
标签
构造
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。