#include <bits/stdc++.h>
using namespace std;
int T;
void solve(){
    int n,k;
    cin >> n >> k;
    cout << k + (k-1)/(n-1) << endl;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> T;
    while (T--) solve();
    return 0;
}
