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