Fegla and the Bed Bugs

No attempts yetTime limit1sMemory limit128 MB

Problem

Fegla, also known as mmaw, coaches a lot of teams. All of them train together in one place, and that place has poor ventilation and is quite small for the number of teams. Under those conditions a strange creature showed up: the bed bug.

Bed bugs are parasites that feed on human blood by biting people. What puzzled Fegla is that some team members were never bitten at all. He cared more about wiping the bugs out, though. After watching them for a while he concluded that he had to stop them from reproducing, and they only reproduce when they get very close to each other.

So Fegla needs your help. You are given a straight line of NN empty cells and KK bed bugs. A cell holds at most one bug. Place the bugs so that the minimum number of empty cells between two consecutive bugs is as large as possible.

For N=4N = 4 and K=2K = 2 the best placement leaves 2 empty cells between the two bugs.

Bed BugEmptyEmptyBed Bug

Input

The first line contains an integer TT, the number of test cases.

Each of the next TT lines contains two integers NN and KK separated by a space.

  • 2N2002 \le N \le 200
  • 2KN2 \le K \le N

Output

For each test case, print the answer on its own line. The answer is the largest value that the minimum number of empty cells between two consecutive bugs can reach over all placements.