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