#include <bits/stdc++.h>
using namespace std;
inline int Int() {
  int x;
  cin >> x;
  return x;
}
inline long long Long() {
  long long x;
  cin >> x;
  return x;
}
inline float Float() {
  float x;
  cin >> x;
  return x;
}
inline double Double() {
  double x;
  cin >> x;
  return x;
}
inline void Yes() { cout << "Yes" << endl; }
inline void No() { cout << "No" << endl; }
inline void YES() { cout << "YES" << endl; }
inline void NO() { cout << "NO" << endl; }
const int N = (int)2e5 + 5;
const int maxN = (int)1e6 + 6;
const long long Mod = (long long)1e9 + 7;
const int inf = (int)2e9;
const long long Inf = (long long)1e18;
int main() {
  int t, q;
  cin >> t;
  for (q = 1; q <= t; q++) {
    long long N, K;
    cin >> N >> K;
    if (K % (N - 1) == 0)
      cout << (K / (N - 1)) * N - 1 << endl;
    else
      cout << (K / (N - 1)) * N + K % (N - 1) << endl;
  }
  return 0;
}
