#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    long long int ans = (n * k) / (n - 1);
    if (ans % n)
      cout << ans << endl;
    else
      cout << (ans - 1) << endl;
  }
}
