#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, k, s, d;
    cin >> n >> k;
    if (k % (n - 1) == 0)
      d = k / (n - 1);
    else
      d = k / (n - 1) + 1;
    long long int low = n * (d - 1);
    long long int z = (low / n) * (n - 1);
    long long int val = low + k - z;
    cout << val << endl;
  }
  return 0;
}
