test = '13 30 3 52' a, b, c, d = map(int, test.split(' ')) total = 0 cnt = 0 while(True): if a == 0 or b == 0: break total += c + 1 a -= 1 b -= c if total > d: break if not (b < 0): cnt += 1 print(cnt)