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