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