#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int x = 1; x <= t; x++) {
    int n, k;
    cin >> n >> k;
    cout << (unsigned long long)(k / (n - 1) * n +
                                 ((k % (n - 1) != 0) ? (k % (n - 1)) : -1))
         << endl;
  }
}
