let () = Scanf.scanf "%d\n" @@ fun n ->
  let ds = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  Printf.printf "%d\n" @@
  Array.fold_left (Array.fold_left ( + )) 0 @@
  Array.init n @@ fun i ->
    Array.init n @@ fun j ->
      if i <= j
      then 0
      else ds.(i) * ds.(j)

