#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    ll n, k;
    cin >> n >> k;
    ll x = (n - 1);
    ll y = (k / x);
    ll z = k % x;
    if (z == 0) {
      z = -1;
    }
    cout << n * y + z << "\n";
  }
  return 0;
}
