A,B,C,D = map(int,input().split()) cnt=0 while D>0: if A>0: if B>=C: A-=1 B-=C if D>=1+C: D-=1 D-=C cnt+=1 else: print(cnt) exit() else: print(cnt) exit() else: print(cnt) exit() print(cnt)