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