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