delicious-prize-8

Lissa has just won the HackerEarth Online Coding Contest. Kuldeep decided to offer her N chocolate boxes each containing at least one chocolate in it. But he knows that Lissa does not like chocolates very much so he wants to place chocolates in the boxes such that the total number of chocolates is minimum.

Given a number N denoting the number of boxes and a number K denoting the product of the number of chocolates in the N boxes, you need to tell Kuldeep the minimum of total number of chocolates that can be placed in the boxes.

Input:

First line of input contains an integer T denoting the total number of test cases.

Each test case consists of a single line containing two space separated integers N and K denoting the number of boxes and the product of the chocolates in n boxes.

Output:

Output consists of  T lines each containing an integer denoting the minimum of total number of chocolates in the N boxes.

Constraints:

 T ≤ 1000

N ≤ 1000

K ≤ 10^9

SAMPLE INPUT
4
2 24
3 24
3 60
4 60

SAMPLE OUTPUT
10
9
12
12

Explanation

test 1: 1st box contains 6 chocolates and 2nd box contains 4 chocolates . So, the total number of chocolates in N boxes are 10 and their product is 24.  

test 2: 1st box contains 4 chocolates and 2nd box contains 3 chocolates and 3rd box contains 2 chocolates.So, the total number of chocolates in N boxes are 9 and their product is 24.

Source: hackerearth | Difficulty: MEDIUM


Solutions: