#!/bin/python3 import sys import math def howManyGames(p, d, m, s): n=math.floor((p-m)/d+1) #sum1=math.floor((n*(2*p-(n-1)*d))/2) #sum1+=d*(s-n) sum1=0 c=0 for i in range(0,n): sum1+=p p-=d c+=1 #print(sum1,c) if(sum1>s): return c-1 for i in range(n,s): sum1+=m c+=1 if(sum1>s): return c-1 return c 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)