A,B,C,D = map(int, input().split()) a=b=d=0 while a<=A and b<=B and d<=D: b+=C a+=1 d+=C+1 print(a-1)