#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 10, mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    long long int div = (k / (n - 1));
    if (k % (n - 1) == 0) div--;
    cout << k + div << '\n';
  }
  return 0;
}
