You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 489E.go
    path of file: ./repos/codeforces-go/main/400-499
    
    the code of the file until where you have to start completion: package main

import (
	"bufio"
	. "fmt"
	"io"
	"math"
)

// github.com/EndlessCheng/codeforces-go
func CF489E(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n int
	var lim float64
	Fscan(in, &n, &lim)
	x := make([]float64, n+1)
	b := make([]float64, n+1)
	for i := 1; i <= n; i++ {
		Fscan(in, &x[i], &b[i])
	}

	dp := make([]float64, n+1)
	from := make([]int, n+1)
	l, r := 0., 1e3
	for step := 40; step > 0; step-- {
		mid := (l + r) / 2
		for i := 1; i <= n; i++ {
			dp[i] = 1e99
			for j, dv := range dp[:i] {
	
    
func CF489E(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n int
	var lim float64
	Fscan(in, &n, &lim)
	x := make([]float64, n+1)
	b := make([]float64, n+1)
	for i := 1; i <= n; i++ {
		Fscan(in, &x[i], &b[i])
	}

	dp := make([]float64, n+1)
	from := make([]int, n+1)
	l, r := 0., 1e3
	for step := 40; step > 0; step-- {
		mid := (l + r) / 2
		for i := 1; i <= n; i++ {
			dp[i] = 1e99
			for j, dv := range dp[:i] {
				res := dv + math.Sqrt(math.Abs(x[i]-x[j]-lim)) - b[i]*mid
				if res < dp[i] {
					dp[i] = res
					from[i] = j
				}
			}
		}
		if dp[n] <= 0 {
			r = mid
		} else {
			l = mid
		}
	}

	ans := []int{}
	for i := n; i > 0; i = from[i] {
		ans = append(ans, i)
	}
	for i := len(ans) - 1; i >= 0; i-- {
		Fprint(out, ans[i], " ")
	}
}