#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k, res;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    res = k + (k - 1) / (n - 1);
    cout << res << '\n';
  }
  return 0;
}
