#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int k;
    cin >> k;
    long long num;
    cout << ((k - 1) / (n - 1)) * n + (k - 1) % (n - 1) + 1 << endl;
  }
}
