This problem is a programming version of Problem 207 from projecteuler.net
For some positive integers , there exists an integer partition of the form ,
where , and are all positive integers and is a real number.
The first two such partitions are and .
Partitions where is also an integer are called .
For any let be the proportion of such partitions that are perfect with .
Thus .
In the following table are listed some values of
...
Find the smallest for which .
Input Format
First line of each test file contains a single integer that is the number of queries per test file. lines follow, with two integers and separated by a single space on each.
Constraints
Output Format
Print exactly lines with an answer for the corresponding query on each.
Sample Input 0
2
2 3
9 20
Sample Output 0
6
30
Explanation 0
, but , therefore, an answer for the first query is .
, which is the first value less than among all where .