This is the first day for you at your new job and your boss asks you to copy some files from one computer to other computers in an informatics laboratory. He wants you to finish this task as fast as possible. You can copy the files from one computer to another using only one Ethernet cable. Bear in mind that any File-copying process takes one hour, and you can do more than one copying process at a time as long as you have enough cables. But you can connect any computer to one computer only at the same time. At the beginning, the files are on one computer (other than the computers you want to copy them to) and you want to copy files to all computers using a limited number of cables.
First line of the input file contains an integer T (1 ≤ T ≤ 100) which denotes number of test cases. Each line in the next T lines represents one test case and contains two integers N, M.
N is the number of computers you want to copy files to them (1 ≤ N ≤ 1,000,000,000). While M is the number of cables you can use in the copying process (1 ≤ M ≤ 1,000,000,000).
For each test case, print one line contains one integer referring to the minimum hours you need to finish copying process to all computers.
In the first test case there are 10 computer and 10 cables. The answer is 4 because in the first hour you can copy files only to 1 computer, while in the second hour you can copy files to 2 computers. In the third hour you can copy files to 4 computers and you need the fourth hour to copy files to the remaining 3 computers.
## Input
First line of the input file contains an integer T (1 ≤ T ≤ 100) which denotes number of test cases. Each line in the next T lines represents one test case and contains two integers N, M.N is the number of computers you want to copy files to them (1 ≤ N ≤ 1,000,000,000). While M is the number of cables you can use in the copying process (1 ≤ M ≤ 1,000,000,000).
## Output
For each test case, print one line contains one integer referring to the minimum hours you need to finish copying process to all computers.
[samples]
## Note
In the first test case there are 10 computer and 10 cables. The answer is 4 because in the first hour you can copy files only to 1 computer, while in the second hour you can copy files to 2 computers. In the third hour you can copy files to 4 computers and you need the fourth hour to copy files to the remaining 3 computers.
**Definitions**
Let $ n \in \mathbb{Z} $ be the number of messages.
For each $ i \in \{1, \dots, n\} $, let $ (a_i, b_i, c_i) \in \mathbb{Z}^3 $ denote the parameters of the $ i $-th message, where:
- $ a_i $: cost of the first option on the new platform,
- $ b_i $: cost of each additional option on the new platform,
- $ c_i $: number of options to purchase.
The sequence $ \{b_i\}_{i=1}^n $ satisfies the constraint:
$$ b_i \leq b_j \quad \text{for all } i \geq j + 5. $$
Let $ S_i = \{ (a_j, b_j) \mid j = 1, \dots, i \} $ be the set of known platforms after processing the $ i $-th message.
**Constraints**
1. $ 1 \leq n \leq 10^5 $
2. $ 1 \leq a_i, b_i, c_i \leq 10^6 $ for all $ i \in \{1, \dots, n\} $
3. $ b_i \leq b_j $ whenever $ i \geq j + 5 $
**Objective**
For each $ i \in \{1, \dots, n\} $, compute the minimal cost to buy $ c_i $ options using any platform in $ S_i $:
$$ \min_{(a_j, b_j) \in S_i} \left( a_j + (c_i - 1) \cdot b_j \right) $$
Output the result for each $ i $ on a separate line.