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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class codeforces639div2 {

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String[] args) {
        FastReader s = new FastReader();
        int a = s.nextInt();
        for (int i = 0; i < a; i++) {
            StringBuilder sb = new StringBuilder();
            int b = s.nextInt();
            int c=s.nextInt();
            if(c==1&&b==1)
                System.out.println(0);
            else {
                int d = c / (b - 1);
                d = d * b;
                if (c % (b - 1) == 0)
                    d--;
                else
                    d += c%(b-1);
//            System.out.println(c%b);
                System.out.println(d);
            }
//            int be=b-(c-1)*2;
//            int bo=b-(c-1);
//            boolean found=false;
//            if(be>0&&be%2==0){
//                found=true;
//                for(int j=0;j<c-1;j++)
//                    sb.append(2+" ");
//                sb.append(be);
//            }
//            else{
//                if(bo>0&&bo%2!=0){
//                    found=true;
//                    for(int j=0;j<c-1;j++)
//                        sb.append(1+" ");
//                    sb.append(bo);
//                }
//            }
//            if(found){
//                System.out.println("YES");
//                System.out.println(sb.toString());
//            }
//            else
//                System.out.println("NO");
//            int c=0,count=0,cn=0;
//            while(b!=0){
//                c=b%10;
//                if(c!=0) {
//                    sb.append((int) (c * Math.pow(10, count)) + " ");
//                cn++;
//                }
//                count++;
//                b/=10;
//            }
//            System.out.println(cn);
//
//            System.out.println(sb.toString());
//            int arr[] = new int[b];
//            for (int j = 0; j < b; j++)
//                arr[j] = s.nextInt();

        }
    }
}