ln =list(map(int, input().split())) a = ln[0] b = ln[1] c = ln[2] d = ln[3] ans = d//(c+1) while ans*c > b: ans -= 1 print(ans)