#include <bits/stdc++.h>
using namespace std;
int num[10005];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    if (n > k) {
      cout << k << endl;
    } else {
      int a = k / (n - 1), b = k % (n - 1);
      if (k % (n - 1) == 0) {
        cout << a * n - 1 << endl;
      } else
        cout << a * n + b << endl;
    }
  }
}
