import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

long calc(long n, long k) {
    long d = k / (n-1);
    return k + d + (k % (n-1) == 0 ? -1 : 0);
}

void main() {
    int t; scan(t);
    foreach (_; 0..t) {
        int n, k; scan(n, k);
        writeln(calc(n, k));
    }
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;
