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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void print(vector<long long> v) {
  for (long long i = 0; i < (long long)v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
vector<long long> div(long long n) {
  vector<long long> v;
  for (long long i = 1; i < (long long)sqrt(n) + 1; i++) {
    if ((n % i) == 0) {
      if (i == n / i)
        v.push_back(i);
      else {
        v.push_back(i);
        v.push_back(n / i);
      }
    }
  }
  return v;
}
long long powmod(long long a, long long b, long long c) {
  if (b == 0)
    return 1 % c;
  else if (b % 2 == 0)
    return powmod((a * a) % c, b / 2, c);
  return (a * powmod((a * a) % c, (b - 1) / 2, c)) % c;
}
bool check(string v) {
  for (long long i = 0; i < (long long)v.size() - 1; i++)
    if (v[i] != v[i + 1]) return false;
  return true;
}
void printp(vector<pair<long long, long long> > v) {
  for (long long i = 0; i < (long long)v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
}
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
void print_map(map<long long, long long> m) {
  for (auto it : m) cout << it.first << " " << it.second << "\n";
}
void print_set(set<long long> s) {
  for (auto it : s) cout << it << " ";
  cout << endl;
}
bool prime[1000005];
void sieve() {
  memset(prime, true, sizeof(prime));
  for (long long i = 2; i * i < 1000005; i++) {
    if (prime[i] == true) {
      for (long long j = i * i; j < 1000005; j += i) {
        prime[j] = false;
      }
    }
  }
}
vector<long long> pow(long long a) {
  vector<long long> res;
  long long temp = 1;
  while (temp <= 1000005) {
    res.push_back(temp);
    temp *= a;
  }
  return res;
}
vector<long long> v = pow(2);
long long modInverse(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long skip = k % (n - 1);
    if (skip == 0)
      cout << n * (k / (n - 1)) - 1 << endl;
    else
      cout << n * (k / (n - 1)) + skip << endl;
  }
  return 0;
}