#include #define rep(i,a,b) for(int i=int(a);i> A >> B >> C >> D; for(int i = A;i >= 0;i--){ if(A * C <= B && A + A * C <= D){ cout << i << endl; return 0; } } }