#!/bin/python3 import sys def howManyGames(p, d, m, s): # Return the number of games you can buy price = p totprice = 0 ngames = 0 while totprice + price <= s: totprice += price ngames += 1 if price - d < m: price = m else: price -= d # print(totprice, price, ngames) return ngames if __name__ == "__main__": p, d, m, s = input().strip().split(' ') p, d, m, s = [int(p), int(d), int(m), int(s)] answer = howManyGames(p, d, m, s) print(answer)