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