3081: LCM

时间限制:500 ms 内存限制:128 MB
上传者:
提交:4 通过:1

题目描述

Silly Slp knows nothing about number theory. One day he feels puzzled with the following problem.

Give two positive integers $n$ and $c$. Find a pair of  positive integer ($a, b$), which satisfies both of $a$ and $b$ are no more than $n$ and the lowest common multiple of them is $c$. Moreover, maximize $a \times b$, the product of $a$ and $b$.

Please tell Silly Slp the maximize value of $a \times b$. If $a$ and $b$ don't exist, print “-$1$”(without quotes).

输入格式

The first line contains an integer number T, the number of test cases.

$i^{th}$ of each next T lines contains two numbers $n$ and $c$($1 \leq n, c \leq 10^{6}$).

输出格式

For each test case print a number, the maximize value.

输入样例 复制

2
10 12
5 36

输出样例 复制

24
-1