a,b,c,d=map(int, input().split()) ans = min(a, b//c, d//(c+1)) print(ans)