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

public class Main {

	public static void main(String[] args) {
		PrintWriter out = new PrintWriter(System.out);
		InputReader in = new InputReader(System.in);

		// Main Program
		{
			int t = in.nextInt();
			while(t-->0){
				int n=in.nextInt();
				int k=in.nextInt();
				out.println(k+((k-1)/(n-1)));
			}
			
		}
		// Main Program Ends
		out.close();

	}

	static class InputReader {
		BufferedReader br;
		StringTokenizer to;

		InputReader(InputStream stream) {
			br = new BufferedReader(new InputStreamReader(stream));
			to = new StringTokenizer("");
		}

		String next() {
			while (!to.hasMoreTokens()) {
				try {
					to = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return to.nextToken();
		}

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

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

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

		int[] readArray(int n) {
			int array[] = new int[n];
			for (int i = 0; i < array.length; i++)
				array[i] = nextInt();
			return array;
		}
	}

	public static void print_array(long[] a, int n) {
		for (int i = 0; i < n; i++) {
			System.out.print(a[i] + " ");
		}
		System.out.println();
	}

	public static int sumdigits(int x) {
		int s = 0;
		while (x != 0) {
			s += x % 10;
			x /= 10;
		}
		return s;
	}

	public static String str_insert_ele(String s, int i, char c) {
		String str = "";
		for (int j = 0; j < i; j++) {
			str = str + s.charAt(j);
		}
		str = str + c;
		for (int j = i; j < s.length(); j++) {
			str = str + s.charAt(j);
		}
		return str;
	}

	public static String str_remove_ele(String s, int i) {
		String str = "";
		for (int j = 0; j < s.length(); j++) {
			if (j != i)
				str = str + s.charAt(j);
		}
		return str;
	}

	static int index(int[] a, int number) {
		int left = 0, right = a.length - 1, mid = (left + right) / 2, ind = 0;
		while (left <= right) {
			if (a[mid] <= number) {
				ind = mid + 1;
				left = mid + 1;
			} else
				right = mid - 1;
			mid = (left + right) / 2;
		}
		return ind;
	}

	public static int[] removeTheElement(int[] arr, int index) {
		if (arr == null || index < 0 || index >= arr.length) {
			return arr;
		}

		int[] anotherArray = new int[arr.length - 1];

		for (int i = 0, k = 0; i < arr.length; i++) {
			if (i == index) {
				continue;
			}
			anotherArray[k++] = arr[i];
		}
		return anotherArray;
	}

	static boolean checkPrime(long n) {
		BigInteger b = new BigInteger(String.valueOf(n));

		return b.isProbablePrime(1);
	}

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

	static long lcm(long a, long b) {
		return (a / gcd(a, b)) * b;
	}

	public static int Search(int[] player, int id) {
		if (player[id] != id) {
			int p = Search(player, player[id]);
			player[id] = p;
			return p;
		}

		return id;
	}

	public static int lcm_of_array_elements(int[] element_array_1) {
		int[] element_array = element_array_1;
		int lcm_of_array_elements = 1;
		int divisor = 2;

		while (true) {
			int counter = 0;
			boolean divisible = false;

			for (int i = 0; i < element_array.length; i++) {

				if (element_array[i] == 0) {
					return 0;
				} else if (element_array[i] < 0) {
					element_array[i] = element_array[i] * (-1);
				}
				if (element_array[i] == 1) {
					counter++;
				}
				if (element_array[i] % divisor == 0) {
					divisible = true;
					element_array[i] = element_array[i] / divisor;
				}
			}
			if (divisible) {
				lcm_of_array_elements = lcm_of_array_elements * divisor;
			} else {
				divisor++;
			}
			if (counter == element_array.length) {
				return lcm_of_array_elements;
			}
		}
	}
}