#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k;
  const double eps = 1e-6;
  cin >> t;
  while (t--) {
    int cnt = 0, r = 1;
    scanf("%d%d", &n, &k);
    printf("%d\n", (k - 1) / (n - 1) + k);
  }
  return 0;
}
