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:
//package practice.codeforce.round_640_div4.C;

import java.io.*;
import java.math.BigInteger;
import java.util.InputMismatchException;
import java.util.Scanner;

public class Solution {

    class Solver {
        public void solve(InputReader in, OutputWriter out) {
            int t = in.readInt();
            for (int c = 0; c < t; c++) {
                int n = in.readInt();
                int k = in.readInt();
                out.printLine((k - 1) / (n - 1) + k);
            }
        }
    }

    public static void main(String[] args) {
        Solution t = new Solution();
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        try {
            if (IS_LOCAL) {
                String packagePath = ROOT + t.getClass().getCanonicalName().replace("." + t.getClass().getSimpleName(), "")
                        .replace(".", "/");
                String inputFileName = packagePath + "/" + INPUT;
                String outputFileName = packagePath + "/" + OUTPUT;

                File inputFile = new File(inputFileName);
                inputStream = new FileInputStream(inputFile);
                Logger.printfln("Reading from file: %s", inputFile.getAbsolutePath());
                File outputFile = new File(outputFileName);
                outputStream = new FileOutputStream(outputFile, false);
                Logger.printfln("Writing to file: %s", outputFile.getAbsolutePath());
            } else {
                Logger.println("Reading stdin and writing to stdout");
            }
        } catch (IOException e) {
            Logger.println(e.toString());
            Logger.println("Reading stdin and writing to stdout");
        }

        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        long start = System.currentTimeMillis();
        new Solution().new Solver().solve(in, out);
        Logger.println(System.currentTimeMillis() - start + "ms");
        out.close();
    }

    public static final boolean IS_LOCAL = false;
    public static String ROOT = "/home/lorderot/projects/algo_problems/src/main/java/";
    public static String INPUT = "input.txt";
    public static String OUTPUT = "output.txt";
}

class IOUtils {
    public static int[] readIntArray(InputReader in, int size) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++)
            array[i] = in.readInt();
        return array;
    }

    public static long[] readLongArray(InputReader in, int size) {
        long[] array = new long[size];
        for (int i = 0; i < size; i++)
            array[i] = in.readLong();
        return array;
    }

    public static int[][] readIntTable(InputReader in, int rowCount, int columnCount) {
        int[][] table = new int[rowCount][];
        for (int i = 0; i < rowCount; i++)
            table[i] = readIntArray(in, columnCount);
        return table;
    }

    public static BigInteger[] readBigInt(InputReader in, int size) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(in.stream)));
        BigInteger[] arr = new BigInteger[size];
        for (int i = 0; i < size; i++) {
            arr[i] = sc.nextBigInteger();
        }
        return arr;
    }

    public static double[] readDoubleArray(InputReader in, int size) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(in.stream)));
        double[] arr = new double[size];
        for (int i = 0; i < size; i++) {
            arr[i] = sc.nextDouble();
        }
        return arr;
    }
}

class InputReader {

    InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}

class Logger {

    public static void println(Object o) {
        if (!Solution.IS_LOCAL) {
            return;
        }
        System.err.println(o);
    }

    public static void print(Object o) {
        if (!Solution.IS_LOCAL) {
            return;
        }
        System.err.print(o);
    }

    public static void printf(String s, Object... objects) {
        if (!Solution.IS_LOCAL) {
            return;
        }
        System.err.printf(s, objects);
    }

    public static void printfln(String s, Object... objects) {
        if (!Solution.IS_LOCAL) {
            return;
        }
        System.err.println(String.format(s, objects));
    }
}