#!/bin/python3 import sys import math def howManyGames(p, d, m, s): if((p-m)%d==0): n=((m-p)/-d) +1 elif ((p-m)%d!=0): n=((((p-m)%d+m)-p)/-d)+1 sum=((n/2)*(p+m)) if(sum<=s): k=n+(s-sum)//m return(k-1) # Return the number of games you can buy 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)