import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines A,B,C,D = map(int,read().split()) def test(x): if x > A: return False y = C * x if y > B: return False if x + y > D: return False return True answer = 0 for i in range(110): if test(i): answer = i print(answer)