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