You have N boxes numbered 1 through N and K candies numbered 1 through K. You put the candies in the boxes in the following order:
So you put the candies in the boxes in the following order: 1,2,3,....,N,N−1,N−2,....,2,1,2,3,....,N,N−1,....
Find the index of the box where you put the K-th candy.
Input format
Output format
For each test case, print the index of the box where you put the K-th candy.
Constraints
1≤T≤1052≤N≤1091≤K≤109
In the first test case, you put the first candy in the first box and the second candy in the second box.
In the second test case, you put the five candies in the boxes with numbers 1, 2, 3, 2, and 1 respectively. So you put the fifth candy in the first box,