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