using System; using System.Linq; using System.Collections.Generic; using System.Text; namespace Solver { interface Output { void Write(object str); void WriteLine(object str); } interface Input { int NextInt(); string NextString(); } class Console_ : Input, Output { Queue param = new Queue(); int Input.NextInt() { if (param.Count == 0) { foreach (var item in Console.ReadLine().Split(' ')) { param.Enqueue(item); } } return int.Parse(param.Dequeue()); } string Input.NextString() { if (param.Count == 0) { foreach (var item in Console.ReadLine().Split(' ')) { param.Enqueue(item); } } return param.Dequeue(); } void Output.Write(object obj) { System.Console.Write(obj); } void Output.WriteLine(object obj) { System.Console.WriteLine(obj); } } class Program { static void Main(string[] args) { new Solver(new Console_(), new Console_()).Run(); } } class Debug_ : Input { int i = 0; int Input.NextInt() { return (int)data[i++]; } string Input.NextString() { return (string)data[i++]; } object[] data = { 1, 2, 2, 2 }; } class Solver { Input input; Output output; public Solver(Input input, Output output) { this.input = input; this.output = output; } public void Run() { var A = input.NextInt(); var B = input.NextInt(); var C = input.NextInt(); var D = input.NextInt(); int tmp = B / C < A ? B / C : A; output.WriteLine(tmp * (1 + C) < D ? tmp : D / (1 + C)); } } }