import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int howManyGames(int p, int d, int m, int s) { // Return the number of games you can buy boolean flag1=true; int count=0; int i=0; while(flag1){ int curr = p-i*d; if(curr<=m ){ if(s>=m){s=s-m;count++;} else flag1=false; } else { if(s>=curr){s=s-curr;count++;} else flag1=false; } i++; } return count; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int p = in.nextInt(); int d = in.nextInt(); int m = in.nextInt(); int s = in.nextInt(); int answer = howManyGames(p, d, m, s); System.out.println(answer); in.close(); } }