#include <bits/stdc++.h>
using namespace std;
int main() {
  long t, n, k, flag = 0, sum = 0;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    if (n > k)
      cout << k << endl;
    else {
      flag = (k - 1) / (n - 1);
      sum = flag + k;
      cout << sum << endl;
    }
  }
  return 0;
}
