using System; using System.Collections.Generic; class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(' '); int a = int.Parse(s[0]); int b = int.Parse(s[1]); int c = int.Parse(s[2]); int d = int.Parse(s[3]); int ans = 0; while(d >= c + 1) { if(a < 1 || b < c) break; a--; b -= c; ans++; d -= c + 1; } Console.WriteLine(ans); } } //mcs Main.cs //mono Main.exe