a,b,c,d = map(int,input().split()) if b*c > a and b*c+a <= d: print(b) exit() for i in range(b): if i*c>a or (4*i)>d: break print(i-1)