#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    long long n, k;
    cin >> n >> k;
    long long num = 0, sum = 0;
    num = k / (n - 1);
    sum = k % (n - 1);
    if (sum == 0) sum = -1;
    cout << sum + num * n << endl;
  }
}
