#include using namespace std; using Int = long long; const char newl = '\n'; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a void drop(const T &x){cout< vector read(size_t n){ vector ts(n); for(size_t i=0;i>ts[i]; return ts; } //INSERT ABOVE HERE signed solve(){ Int n,a,w,k; cin>>n>>a>>w>>k; if(n==1){ cout<0){ // cout<<"A"<= 0 -> all WA canceled auto floor=[&](Int x,Int y){ if(x>=0) return x/y; return x/y-(abs(x)%y!=0); }; cout<= 0 // (x + 1) * (k - 1) + x <= a // x * k + k - x - 1 + x <= a // x * k <= a - (k - 1) // x <= (a - (k - 1)) / k cout<< (a - (k - 1)) / k << newl; return 0; } signed main(){ cin.tie(0); ios::sync_with_stdio(0); Int T; cin>>T; while(T--) solve(); return 0; }