let id x = x

let print_complex { Complex.re; Complex.im } = Printf.printf "%f + i %f" re im

let rot90 { Complex.re; Complex.im } = { Complex.re = ~-.im; Complex.im = re }

let scalar_mul t { Complex.re; Complex.im } = { Complex.re = t *. re; Complex.im = t *. im }

module Circle = struct
  type t = { center : Complex.t; radius : float }
  
  let eps = 1e-8

  let contains c p = Complex.norm2 (Complex.sub c.center p) <= c.radius *. c.radius +. eps

  let intersections_of_circles { center = p1; radius = r1 } { center = p2; radius = r2 } =
    let d = Complex.sub p2 p1 in
    let e = rot90 d in
    let s = (Complex.norm2 d +. r1 *. r1 -. r2 *. r2) /. (2.0 *. Complex.norm2 d) in
    let a = scalar_mul s d in
    let t = sqrt (r1 *. r1 /. Complex.norm2 d -. s *. s) in
    let b = scalar_mul t e in
    let intersected = abs_float (r1 -. r2) <= Complex.norm d +. eps &&
                      Complex.norm d <= r1 +. r2 +. eps in
    if intersected
    then [Complex.add p1 (Complex.add a b); Complex.add p1 (Complex.sub a b)]
    else []
end

let n = Scanf.scanf "%d" id
let k = Scanf.scanf " %d" id
let a = Array.to_list @@ Array.init n (fun _ ->
  let p = Scanf.scanf " %f %f" (fun x y -> { Complex.re = x; Complex.im = y }) in
  let c = Scanf.scanf " %f" id in
  (p, c))

let can t =
  let cs = List.map (fun (p, c) -> { Circle.center = p; Circle.radius = t /. c }) a in
  let rec f cs acc = match cs with
    | [] -> acc
    | c1 :: cs -> f cs (List.fold_left (fun acc c2 -> Circle.intersections_of_circles c1 c2 @ acc) acc cs) in
  let ps = f cs (List.map fst a) in
  List.exists (fun p -> List.length (List.filter (fun c -> Circle.contains c p) cs) >= k) ps

let rec binary_search lb ub n =
  if n = 0
  then ub
  else let m = (lb +. ub) /. 2.0 in
       if can m
       then binary_search lb m (n - 1)
       else binary_search m ub (n - 1)

let () = Printf.printf "%.10f\n" @@ binary_search 0.0 1e8 100