#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  long long k, n, j, c;
  scanf("%d", &t);
  while (t--) {
    scanf("%lld %lld", &n, &k);
    c = k + floor((k - 1) / (n - 1));
    printf("%lld\n", c);
  }
  return 0;
}
