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.*;

public class Q_1352C {
   public static PrintWriter out; // -----------PrintWriter for faster output--------------
   public static class MyScanner { // -----------MyScanner class for faster input----------
      BufferedReader br;
      StringTokenizer st;
      public MyScanner() { 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; }
      int[] reada(int n) { int[] input = new int[n]; for (int i = 0; i < n; i++) input[i] = nextInt(); return input; }
      Map<Integer, Integer> readmap(Map<Integer, Integer> map,int n){for(int i=0;i<n;i++){ int a = nextInt(); if(!map.containsKey(a)) map.put(a, 1); else map.put(a, map.get(a)+1); } return map;}
      Map<String, Integer> readmaps(Map<String, Integer> map,int n){for(int i=0;i<n;i++){ String a = nextLine(); if(!map.containsKey(a)) map.put(a, 1); else map.put(a, map.get(a)+1); } return map;}
    }
   public static void printa(int[] a) { for (int i = 0; i < a.length; i++)out.print(a[i] + " "); }
   public static void printm(Map<Integer, Integer> map){map.forEach((k, v) -> System.out.println(k + " : " + v ));}
   public static void printmi(Map<String, Integer> map){map.forEach((k, v) -> System.out.println(k + " : " + v ));}
   public static boolean e(long n) { if (n % 2 == 0) return true; return false; }
   public static boolean sq(long n) { double sq = Math.sqrt(n);if (sq == (int) sq) return true; return false; }
   public static int[][] sort2d(int[][] a) { Arrays.sort(a, Comparator.comparingInt(o -> o[0])); return a; }
   public static boolean rem(long a,long b, long c){ if(a%b == c) return true; return false; }
   // ------------------------------------------------------------------------------------------------------------------------------

// we can create our function here...just above the main function

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

      /*
         Approach: 
         - firstly, we need to find out the number of groups of the number having non divisible numbers <= k
            i.e i = k / n-1;
                                       n = 3, k = 7, i = 3
                                       1 2 3, 4 5 6, 7 8 9
         - now we've got the number of pairs, now get the total number of non divisible numbers in that.
            formula --> i*(n-1)
         
         - if now, the answer will be i*(n-1) + i + rem
         where rem = k - i*(n-1) i.e required number of non divisible nmbrs - available non div numbers
      
      */

      int t = sc.nextInt();
      while(t-- > 0){
         long n = sc.nextLong();
         long k = sc.nextLong();

         // method 1
         // out.println(k + (long)Math.floor((k-1)/(n-1)));

         // method 2
         long i = k / (n-1);
         long rem =  k - i*(n-1);

         if(rem == 0) out.println(n*i -1);
         else out.println(n*i + rem);
      }

    out.close();
   }
}