https://codeforces.com/problemset/problem/1352/C
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
int main(void)
{
int t; cin>>t;
while(t--)
{
LL n,k; cin>>n>>k;
LL a=k%(n-1);
if(!a) a=n-1;
LL b=k/(n-1);
if(k%(n-1)==0) b--;
cout<<a+b*n<<endl;
}
}