a,b,c,d = map(int,input().split()) res = 0 for i in range(a + 1): e = c * i + i if e <= d: res = max(res, i) print(res)