package main import ( "fmt" "math" ) func main() { var v1, v2, d1, d2, od1, od2, w float64 _, _ = fmt.Scan(&v1, &v2, &d2, &w) p := math.Pow10(8) total := 0.0 for { t := (d2 - d1) / (v2 + w) total += t od1, od2, d1, d2 = d1, d2, d1+v1*t, d2-v2*t // fmt.Println(t, total, d1, d2) if int(od1*p) == int(d1*p) && int(od2*p) == int(d2*p) { break } } fmt.Printf("%.12f\n", total*w) }