import std.algorithm; import std.array; import std.conv; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; T read(T)() { return readln.chomp.to!T; } T[] reads(T)() { return readln.split.to!(T[]); } alias readint = read!int; alias readints = reads!int; int calc(int a, int b, int c, int d) { int ans = 0; for (int i = 0; i <= a; i++) { if (i * c <= b && i + i * c <= d) { ans = i; } } return ans; } void main() { auto xs = readints; int a = xs[0], b = xs[1], c = xs[2], d = xs[3]; writeln(calc(a, b, c, d)); }