#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int t;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    long long int q = k / (n - 1);
    long long int r = k % (n - 1);
    if (r == 0) {
      cout << n * q - 1 << "\n";
    } else {
      cout << n * q + r << "\n";
    }
  }
  return 0;
}
