#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int temp = k / (n - 1);
    if (k % (n - 1) == 0) {
      cout << temp * n - 1 << "\n";
    } else {
      cout << temp * n + (k % (n - 1)) << "\n";
    }
  }
  return 0;
}
