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