#include #include using namespace std;using namespace boost::multiprecision;int main(){int t;cin>>t;while(t--){cpp_int D,A,B,K,n,a,b,c,d,m,x,g,r,l=0,h,q,s,v;cin>>D>>A>>B>>K;D/=g=gcd(D,A);A/=g;if(A*B%D<1&&D*K+2>A){cout<<-1<<'\n';}else{h=A*B*K+2;while(l+1