#yuki804 a,b,c,d=map(int,raw_input().split()) print min(a,b/c,d/(c+1))