s = str(input()) s = s.split(" ") veg = int(s[0]) meat = int(s[1]) times = int(s[2]) max_ = int(s[3]) total = 0 while veg > 0 and meat > 0 and max_ > 0: if veg * (1 + times) <= max_ and times <= meat: total += 1 meat -= times veg -= 1 max_ -= (1 + times) else: veg = 0 break print(total)