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