# coding: utf-8 # Your code here! a,b,c,d = map(int,input().split()) cnt=0 while(d>c+1): if(a>0 and b>=c): a-=1 b-=c d-=(1+c) cnt+=1 print(cnt)