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 int sum = 0; int cnt = 0; for(int i=0; ; i++){ if (i == 0){ sum = sum + p; if (s >= sum) cnt++; else break; } else{ if (p - d*i >= m){ sum = sum + p - d*i; if (s >= sum) cnt++; else break; } else{ sum = sum + m; if (s >= sum) cnt++; else break; } } } return cnt; } 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(); } }