Problem: You are given two positive integers n and k. Print the k-th positive integer that is not divisible by n.

For example, if n=3, and k=7, then all numbers that are not divisible by 3 are: 1, 2, 4, 5, 7, 8, 10, 11, 13 .... The 7-th number among them is 10.

Input

The first line contains an integer t (1 ≤ t ≤ 1000) — the number of test cases in the input. Next, t test cases are given, one per line.

Each test case is two positive integers n (2 ≤ n ≤ 10^9) and k (1 ≤ k ≤ 10^9).

Output

For each test case print the k-th positive integer that is not divisible by n.

Example

Input


6
3 7
4 12
2 1000000000
7 97
1000000000 1000000000
2 1


Output


10
15
1999999999
113
1000000001
1

Solution (in PYTHON3):

Solution:
class A:

    def solve(self):
        t = int(input())
        for i in range(t):
            n = list(map(int, input()))
            round_numbers = list(map(lambda x: x[0] * 10**x[1], filter(lambda x: x[0] > 0,
                                                                   zip(n, reversed(list(range(len(n))))))))
            print(len(round_numbers))
            print(" ".join(map(str, round_numbers)))

class B:

    def solve(self):
        t = int(input())
        for p in range(t):
            in_list = list(map(int, input().split(" ")))
            n, k = in_list[0], in_list[1]
            if k % 2 == 1:
                if n % 2 == 0:
                    first_term = n - (k - 1) * 2
                    if first_term <= 0:
                        print("NO")
                        continue
                    print("YES")
                    print(" ".join([str(first_term)] + ["2" for x in range(k - 1)]))
                else:
                    first_term = n - (k - 1)
                    if first_term <= 0:
                        print("NO")
                        continue
                    print("YES")
                    print(" ".join([str(first_term)] + ["1" for x in range(k - 1)]))
            else:
                if n % 2 == 0:
                    first_term = n - (k - 1)
                    if first_term <= 0:
                        print("NO")
                        continue

                    if first_term % 2 == 1:
                        print("YES")
                        print(" ".join([str(first_term)] + ["1" for x in range(k - 1)]))
                        continue

                    first_term = n - (k - 1) * 2

                    if first_term <= 0:
                        print("NO")
                        continue

                    if first_term % 2 == 0:
                        print("YES")
                        print(" ".join([str(first_term)] + ["2" for x in range(k - 1)]))
                    else:
                        print("NO")
                else:
                    print("NO")


class C:

    def solve(self):
        t = int(input())
        for p in range(t):
            in_list = list(map(int, input().split(" ")))
            n, k = in_list[0], in_list[1]
            m = k // (n - 1)
            if (k % (n - 1) == 0):
                print(m * n - 1)
                continue

            print(m * n + k % (n - 1))

C().solve()