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.util.*;
import java.io.*;

/**
 * @author AnonymousP
 * @__WHEN YOU FEEL LIKE QUITTING, THINK ABOUT WHY YOU STARTED__@
 */
 
public class k {
    public static void main(String[] args) {
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int something = k / (n - 1);
            prln((k + something) % n == 0 ? k + something - 1 : k + something);
        }
        close();
    }

    private static void bs(int n, int k) {
        int low = 1;
        int high = Integer.MAX_VALUE;
        int res = -1;
        while (low <= high) {
            int mid = low + (high - low) / 2;
            int now = mid - mid / n;
            if (now < k) {
                low = mid + 1;
                //shamne khujbo
            } else {
                res = mid;
                high = mid - 1;
            }

        }
        prln(res);
    }

    static FastReader sc = new FastReader();
    static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out));
    static StringTokenizer input;
    static Random __rand = new Random();


    //************************************************************************//

    //************************************************************************//
    //CLASS_CLASS_CLASS_CLASS_CLASS_CLASS_CLASS_CLASS_CLASS_CLASS_CLASS_CLASS_//
    //*******FAST IO*************FAST IO***************FAST IO****************//
    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;
        }
    }

    // output
    static void pr(int i) {
        __out.print(i);
    }

    static void prln(int i) {
        __out.println(i);
    }

    static void pr(long l) {
        __out.print(l);
    }

    static void prln(long l) {
        __out.println(l);
    }

    static void pr(double d) {
        __out.print(d);
    }

    static void prln(double d) {
        __out.println(d);
    }

    static void pr(char c) {
        __out.print(c);
    }

    static void prln(char c) {
        __out.println(c);
    }

    static void pr(char[] s) {
        __out.print(new String(s));
    }

    static void prln(char[] s) {
        __out.println(new String(s));
    }

    static void pr(String s) {
        __out.print(s);
    }

    static void prln(String s) {
        __out.println(s);
    }

    static void pr(Object o) {
        __out.print(o);
    }

    static void prln(Object o) {
        __out.println(o);
    }

    static void prln() {
        __out.println();
    }

    static void pryes() {
        __out.println("yes");
    }

    static void pry() {
        __out.println("Yes");
    }

    static void prY() {
        __out.println("YES");
    }

    static void prno() {
        __out.println("no");
    }

    static void prn() {
        __out.println("No");
    }

    static void prN() {
        __out.println("NO");
    }

    static void pryesno(boolean b) {
        __out.println(b ? "yes" : "no");
    }


    static void pryn(boolean b) {
        __out.println(b ? "Yes" : "No");
    }

    static void prYN(boolean b) {
        __out.println(b ? "YES" : "NO");
    }

    static void prln(int... a) {
        for (int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i) ;
        __out.println(a[a.length - 1]);
    }

    static void prln(long... a) {
        for (int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i) ;
        __out.println(a[a.length - 1]);
    }

    static <T> void prln(Collection<T> c) {
        int n = c.size() - 1;
        Iterator<T> iter = c.iterator();
        for (int i = 0; i < n; __out.print(iter.next()), __out.print(' '), ++i) ;
        if (n >= 0) {
            __out.println(iter.next());
        } else {
            __out.println();
        }
    }

    static void h() {
        __out.println("hlfd");
        flush();
    }

    static void flush() {
        __out.flush();
    }

    static void close() {
        __out.close();
    }

    //*******FAST IO*************FAST IO***************FAST IO****************//
}