#include <bits/stdc++.h>
int main() {
  int t = 0;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    int n = 0, k = 0, skipped = 0, cur = 0;
    scanf("%d%d", &n, &k);
    skipped = k / (n - 1);
    if ((k % (n - 1)) != 0)
      printf("%d\n", (skipped * n) + 1 + ((k % (n - 1)) - 1));
    else
      printf("%d\n", (skipped * n) - 1);
  }
  return 0;
}
