let () =
  let minkowski_dist x y p =
    if p = infinity 
    then List.fold_left2 (fun acc x y -> max acc (abs_float (x-.y))) 0. x y 
    else List.fold_left2 (fun acc x y -> acc +. (abs_float (x-.y) ** p))
        0. x y ** (1./.p)
  in
  let parse str = str
                  |> Str.split (Str.regexp " ")
                  |> List.map float_of_string in
  let _ = read_line () in
  let x = read_line () |> parse in
  let y = read_line () |> parse in
  List.iter
    (fun p -> minkowski_dist x y p |> Printf.printf "%f\n")
    [1.;2.;3.;infinity]