We all know that harry potter loves jellys from Fred and George's shop. One such day he went to the shop asking for jellies. Then Fred gave him N jellies. Before giving the jellies harry drunk a magical potion which has magic in it.The user manual of potion said,"The one who drinks it will eat twice jellies after eating C number of jellies and it will continue". Now Fred gives him N jellies. Harry want to know in what minimum time he will eat all jellies if he starts by eating 1 jelly.NOTE 1 POINT EVEN IF HE EAT 2*C jeelies the rate of eating will be 1 until he reaches c. Can you help him?
Input Format:
First lint of input consists of an integer T denoting the number of test cases. For each line there are two numbers N and C seperated by a space.
Output Format:
Output a single integer for each test case denotng the time required.
Constraints