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:
import sys
from math import gcd,ceil,sqrt,ceil
from math import gcd,ceil,floor,sqrt,copysign,factorial,fmod,fsum,degrees
from math import expm1,exp,log,log2,acos,asin,cos,tan,sin,pi,e,tau,inf,nan,atan2

INF = float('inf')
MOD = 998244353
mod = 10**9+7
from collections import Counter,defaultdict as df
from functools import reduce
def counter(l): return dict(Counter(l))
def printm(l):
    for i in range(len(l[0])):
        print(*l[i])
def P(n) : 
    if (n <= 1) :return False
    if (n <= 3) :return True
    if (n % 2 == 0 or n % 3 == 0) :return False
    for i in range(5,ceil(sqrt(n))+1,6):
        if (n % i == 0 or n % (i + 2) == 0) :return False
    return True
def lcm(a,b): 
    return int((a*b) / gcd(a,b))
def so(x):      return {k: v for k, v in sorted(x.items(), key=lambda item: item[1])}
def rev(l):     return list(reversed(l))
def ini():      return int(sys.stdin.readline())
def inp():      return map(int, sys.stdin.readline().strip().split())
def li():       return list(map(int, sys.stdin.readline().strip().split()))
def input():    return sys.stdin.readline().strip()
def inputm(n,m):return [li() for i in range(n)]
def solve():
    a,b=inp()
    c=b//(a-1)
    x=a*c
    x+=b%(a-1)
    if b%(a-1)==0:
        x-=1
    print(x)
        
            
    
        
        
    
        
    
    
        
            
            
        
    






for i in range(ini()):
    solve()

#सर्वभूतेष्वभयदस्तं देवा ब्राह्मणं विदुः ॥ भावार्थ : जो व्यक्ति सम्मान दिए जाने अथवा अपमान किये जाने पर न तो प्रसन्न होता है और न ही नाखुश, और जो सभी प्राणियों अभय देता है उसी को देवतागण ब्राह्मण कहते है । नाभिनन्देत मरणं नाभिनन्देत जीवितम् ।