#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
const string yes = "YES\n";
const string no = "NO\n";
const int SZ1 = 2020;
void solve() {
  int n, k, ch = 0;
  cin >> n >> k;
  cout << k + (k - 1) / (n - 1) << '\n';
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
