n=list(map(int,input().split())) print(min(n[0], n[1] // n[2], n[3] // (n[2] + 1)))