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