ll@T,D[2d3];rep(T){ll@A,@B,r=Divisor(B-A,D);while(--r&&D[r-1]/A);wt(max(D[r]-A,-(A