a,b,c,d=map(int,input().split()) ans=0 while(True): x=ans+1 if(x>a): break; if(x*c>b): break; if(x*(c+1)>d): break; ans+=1 pass; print(ans)