a,b,c,d = map(int,input().split()) x = 0 for i in range(a+1) : if (x+x*c <= d) and (x <= a) and (x*c <= b) : x += 1 else : print(x-1) break