A,B,C,D =map(int,input().split()) B = B//C D = D//(C+1) print(min(A,B,D))