let rec select acc trace = function
  | [] -> acc
  | x :: xs -> select ((trace, x, xs) :: acc) (x :: trace) xs
let select xs = select [] [] xs

let rec perm : int -> 'a list -> 'a list list = fun n xs ->
  match n, xs with
  | 0, _ -> [[]]
  | _, [] -> []
  | n, xs ->
      List.concat @@
        List.map (fun (xs, x, ys) ->
          List.map (fun xs -> x :: xs) @@
            perm (n - 1) @@ List.rev_append xs ys) @@ select xs

let () = Scanf.scanf "%d\n" @@ fun n ->
  let xys = Array.init n @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun x y -> x, y in
  let routes =
    List.map (fun is ->
      let is' = Array.of_list is in
      Array.fold_left ( +. ) 0. @@
      Array.init (n - 1) @@ fun i ->
        let (x, y) = xys.(is'.(i)) in
        let (x', y') = xys.(is'.(i + 1)) in
        sqrt @@ float_of_int @@ (x - x') * (x - x') + (y - y') * (y - y')) @@
    perm n @@
    Array.to_list @@
    Array.init n @@ fun i -> i in
  Printf.printf "%.10f\n" @@ List.fold_left ( +. ) 0. routes /. float_of_int (List.length routes)

