# /usr/bin/python # -*- coding: utf-8 -*- # import sys def solve(A,B,C,D): ans = 0 while(1): if ans > A or C*ans > B: return max(ans-1, 0) elif (1+C)*ans > D: return max(ans-1, 0) else: ans += 1 a,b,c,d = map(int, input().split()) print(solve(a,b,c,d))