#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>a>>b>>c>>d; Int x=0; while(1){ Int y=x+1; if(y>a) break; if(y*c>b) break; if(y+y*c>d) break; x++; } cout<