v, m, vm, max = map(int, input().split(' ')) ans = m // vm if ans > max: ans = max if ans > v: ans = v print(ans)