#include using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) const LL result_impossible = -1000000000000; LL testcase(){ LL N,A,W,K; cin>>N>>A>>W>>K; if(A= low_width*diff + (N-1)){ // low+diff <= ans A -= low_width*diff + (N-1); return low+diff + A/K; } if(A >= low_width-1){ // low <= ans < low+diff A-=low_width-1; return min(low + A/low_width, low+diff-1); } // ans < low LL ans=low-(diff+1); ans+=min(diff,A); return ans; } int main(){ int T; cin>>T; rep(t,T){ LL ans=testcase(); if(ans==result_impossible) cout<<":("<