#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int close_sycn = (ios::sync_with_stdio(false), cin.tie(0), 0);
int main() {
  LL t, n, k;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    LL res = k / (n - 1) * n;
    LL p = k % (n - 1);
    res += p == 0 ? -1 : p;
    cout << res << '\n';
  }
  return 0;
}
