#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  for (int p = 0; p < t; p++) {
    long long int n, k;
    cin >> n >> k;
    double ans = (1.0 * n * k) / (n - 1);
    long long int m = ans;
    if (m == ans) {
      if (((m - 1) - (m - 1) / n) == k)
        cout << m - 1 << endl;
      else {
        cout << m << endl;
      }
    } else {
      cout << m << endl;
    }
  }
  return 0;
}
