let split str delim =
  let rec doit s acc =
    match 
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let nth_root x n =
  let fn = float_of_int n in
  if x < 0. && n mod 2 = 1 then (-. exp (log (-. x) /. fn))
  else exp (log x /. fn)

let rec power m = function
  | 0 -> 1.
  | n when n mod 2 = 0 -> power (m *. m) (n / 2)
  | n -> m *. power m (n - 1)

let minkowski_distance x y n p =
  let rec doit i acc =
    if i >= n then acc
    else doit (i + 1) (acc +. (power (abs_float (x.(i) -. y.(i))) p))
  in
  nth_root (doit 0 0.) p

let manhattan_distance x y n = minkowski_distance x y n 1
let euclidean_distance x y n = minkowski_distance x y n 2
let three_norm_distance x y n = minkowski_distance x y n 3

let chebyshev_distance x y n =
  let rec doit i ret =
    if i >= n then ret
    else doit (i + 1) (max ret (abs_float (x.(i) -. y.(i))))
  in
  doit 0 (-1.)

let () =
  let ary_of_str l = Array.of_list (List.map float_of_string (split l ' ')) in
  let n = read_int () in
  let x = ary_of_str (read_line ()) in
  let y = ary_of_str (read_line ()) in
  Printf.printf "%f\n" (manhattan_distance x y n);
  Printf.printf "%f\n" (euclidean_distance x y n);
  Printf.printf "%f\n" (three_norm_distance x y n);
  Printf.printf "%f\n" (chebyshev_distance x y n);