#include <bits/stdc++.h>
using namespace std;
int main() {
  long long T;
  cin >> T;
  while (T--) {
    long long n, k, i;
    cin >> n >> k;
    long long diff = n - 1;
    if (k % diff == 0)
      i = k / diff;
    else
      i = (k / diff) + 1;
    long long value = k - 1 + i;
    cout << value << "\n";
  }
}
