import strutils let read* = iterator: string = while true: (for s in stdin.readLine.split: yield s) template input*(T: static[typedesc]): untyped = when T is int: read().parseInt elif T is float: read().parseFloat elif T is string: read() elif T is char: read()[0] let A, B, C, D = input(int) for R in countdown(A, 0): if R * C <= B and R + R * C <= D: echo R; quit(0)