#include <bits/stdc++.h>
int main() {
  long long int i, t, n, k, a, b, c;
  scanf("%lld", &t);
  for (i = 1; i < t + 1; i++) {
    scanf("%lld%lld", &n, &k);
    a = k - 1;
    b = n - 1;
    c = a / b;
    printf("%lld\n", k + c);
  }
  return 0;
}
