n=list(map(int,input().split())) a=n[0] b=n[1] c=n[2] d=n[3] cnt=0 for i in range(n[0]): a-=1 b-=c d-=(c+1) if(a>=0 and b>=0 and c>=0): cnt+=1 else: break print(cnt)