import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = Integer.parseInt(sc.next()); int b = Integer.parseInt(sc.next()); int c = Integer.parseInt(sc.next()); int d = Integer.parseInt(sc.next()); int tempA = 0, tempB = 0, ans = 0; while(tempA + tempB <= d) { if(tempA + 1 <= a && tempB + c <= b) { tempA++; tempB += c; ans++; } } System.out.println(--ans); } }