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 javax.swing.plaf.basic.BasicScrollPaneUI;
import java.io.*;
import java.util.*;

public class Main {


    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private final DataInputStream din;
        private final byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[100000 + 1]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            din.close();
        }
    }

    static Reader sc = new Reader();
    static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));


    public static void main(String[] args) throws IOException {

       int t=sc.nextInt();
       while(t>0){
           t--;
           long n = sc.nextInt();
           long  k =sc.nextInt();
           if(k%(n-1)==0){
               System.out.println(n*(k/(n-1))-1);
           }else{
               System.out.println(n*(k/(n-1))+(k%(n-1)));
           }
       }


    }
    private static boolean isAnswer(List<Long> arr, double ll, double m) {
        if(arr.get(0)>m){
            return false;
        }
        if((ll-arr.get(arr.size()-1))>m){
            return false;
        }
        for(int i=0;i<arr.size()-1;i++){
            if((arr.get(i+1)-arr.get(i))>2*m){
                return false;
            }
        }
        return true;

        //return true;

    }

    private static String printList(List<Integer> arr) {
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < arr.size(); i++) {
            if (i != arr.size() - 1) {
                ans.append(arr.get(i)).append(" ");
            } else {
                ans.append(arr.get(i));
            }
        }
        return ans.toString();

    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    private static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }


    public static int getpa(int[] arr, int n, int k) {
        int ans = 0;
        Map<Integer, Integer> map = new HashMap<>();
        ;
        for (int i = 0; i < n; i++) {
            int a = arr[i];
            if (!map.containsKey(a)) {
                map.put(a, 1);
            } else {
                int aa = map.get(a);
                aa++;
                map.put(a, aa);
            }

        }
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            int a = entry.getKey();
            int f = entry.getValue();
            System.out.println(a + " " + f);
            if (map.containsKey(k - a)) {
                System.out.println(map.get(k - a));
                ans += Math.max(f, map.get(k - a));
                map.put(a, 0);
            }
        }
        return ans;
    }

    public static String printArray(int[] arr) {

        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < arr.length; i++) {
            if (i != arr.length - 1) {
                ans.append(arr[i]).append(" ");
            } else {
                ans.append(arr[i]);
            }
        }
        return ans.toString();
    }
}