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;
void __print(int x) { cout << x; }
void __print(long x) { cout << x; }
void __print(long long x) { cout << x; }
void __print(unsigned x) { cout << x; }
void __print(unsigned long x) { cout << x; }
void __print(unsigned long long x) { cout << x; }
void __print(float x) { cout << x; }
void __print(double x) { cout << x; }
void __print(long double x) { cout << x; }
void __print(char x) { cout << '\'' << x << '\''; }
void __print(const char *x) { cout << '\"' << x << '\"'; }
void __print(const string &x) { cout << '\"' << x << '\"'; }
void __print(bool x) { cout << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x);
template <typename T>
void __print(const vector<T> &x);
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cout << '{';
  __print(x.first);
  cout << ',';
  __print(x.second);
  cout << "}";
}
template <typename T>
void __print(const vector<T> &x) {
  cout << "{";
  for (int u69 = 0; u69 < x.size(); u69++) {
    __print(x[u69]);
    cout << (u69 + 1 == x.size() ? "" : ",");
  };
  cout << "}";
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cout << '{';
  for (auto &i : x) cout << (f++ ? "," : ""), __print(i);
  cout << "}";
}
void _print() { cout << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cout << ", ";
  _print(v...);
}
const int mod = 1000000007;
const double eps = 1e-14;
void YES(bool t = 1) {
  const string YESNO[2] = {"NO", "YES"};
  cout << YESNO[t] << endl;
}
void Yes(bool t = 1) {
  const string YesNo[2] = {"No", "Yes"};
  cout << YesNo[t] << endl;
}
void yes(bool t = 1) {
  const string yesno[2] = {"no", "yes"};
  cout << yesno[t] << endl;
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
long long mpow(int b, int e, int modu = 0, int mod = 1000000007) {
  long long result = 1, base = b, exp = e;
  if (modu) base %= mod;
  while (exp > 0) {
    if (exp & 1) {
      result = ((long long)result * base);
      if (modu) result %= mod;
    }
    base = ((long long)base * base);
    if (modu) base %= mod;
    exp >>= 1;
  }
  return result;
}
inline bool isPowerOfTwo(long long x) { return x && (!(x & (x - 1))); }
bool isPerfectSquare(long long x) {
  long long sr = sqrt(x);
  return ((sr * sr) == x);
}
bool isIn(string &s2, string &s1) {
  if (s1.find(s2) != string::npos) return true;
  return false;
}
bool isSorted(vector<int> &arr) {
  for (int i = 0; i < (int)arr.size() - 1; i++)
    if (arr[i] > arr[i + 1]) return false;
  return true;
}
long long solve(int n, int s, int e) {
  int mid = e / n - s / n;
  if (mid == 0) return e;
  return solve(n, e, e + mid);
}
int TEST_CASES = 1;
void submain() {
  long long n, k;
  cin >> n >> k;
  cout << solve(n, 1, k) << '\n';
}
int main() {
  { ios_base::sync_with_stdio(false); }
  {
    cin.tie(NULL);
    cout.tie(NULL);
  }
  int t = 1;
  if (TEST_CASES) {
    cin >> t;
  }
  while (t--) {
    submain();
  }
  return 0;
}