def ans(a, b, c, d): return min(a, b//c ,d/(c+1)) if __name__ == '__main__': a, b, c, d = map(int, input().split()) print(ans(a, b, c, d))