## Algorithm

A. Floor Number
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n.

There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains 22 apartments, every other floor contains x apartments each. Apartments are numbered starting from one, from the first floor. I.e. apartments on the first floor have numbers 11 and 22, apartments on the second floor have numbers from 33 to (x+2)(�+2), apartments on the third floor have numbers from (x+3)(�+3) to (2x+2)(2⋅�+2), and so on.

Your task is to find the number of floor on which Petya lives. Assume that the house is always high enough to fit at least n apartments.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1t10001≤�≤1000) — the number of test cases. Then t test cases follow.

The only line of the test case contains two integers n and x (1n,x10001≤�,�≤1000) — the number of Petya's apartment and the number of apartments on each floor of the house except the first one (there are two apartments on the first floor).

Output

For each test case, print the answer: the number of floor on which Petya lives.

Example
input
Copy
4
7 3
1 5
22 5
987 13

output
Copy
3
1
5
77

Note

Consider the first test case of the example: the first floor contains apartments with numbers 11 and 22, the second one contains apartments with numbers 3344 and 55, the third one contains apartments with numbers 6677 and 88. Therefore, Petya lives on the third floor.

In the second test case of the example, Petya lives in the apartment 11 which is on the first floor.

## Code Examples

### #1 Code Example with C++ Programming

Code - C++ Programming

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define endl '\n'
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int t;
cin>>t;
while(t--){
int n, x;
cin>>n>>x;
if( n > 2){
n -= 2;
if(n % x > 0){
cout<<(n / x + 2)<<endl;
}
else{
cout<<(n / x + 1)<<endl;
}
}
else{
cout<<1<<endl;
}

}
}
Copy The Code &

Input

cmd
4
7 3
1 5
22 5
987 13

Output

cmd
3
1
5
77