using System; using System.Linq; namespace lv1_804 { class Program { static void Main(string[] args) { int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); int a = input[0], b = input[1], c = input[2], d = input[3]; int i = a; while (i != 0) { if (i + c * i <= d) break; if (c * i >= b) i--; } Console.WriteLine(i); } } }