#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b % 2) res = (res * a) % 1000000007;
    b /= 2;
    a = (a * a) % 1000000007;
  }
  return res;
}
void solve() {
  long long n, m, i, j, k, l, sum = 1, flag = 0, t, ans = 0;
  string s, s1 = "", s2;
  cin >> n >> k;
  i = k / (n - 1);
  j = k % (n - 1);
  if (j == 0) j = -1;
  cout << (n * i + j) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int test = 1;
  cin >> test;
  while (test--) {
    solve();
  }
  return 0;
}
