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