#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int MOD = 1e9;
int k, n, t;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> k;
    int n2 = n - 1;
    if (k < n2) {
      cout << k << endl;
      continue;
    }
    int boi = k / n2;
    int du = k % n2;
    if (k % n2 == 0) {
      cout << n * boi - 1 << endl;
      continue;
    }
    if (k % n2 != 0) cout << (n * boi) + du << endl;
  }
  return 0;
}
