let i_inp_list : unit -> int list = fun () ->
  let inp_split = Str.split (Str.regexp " ") (input_line stdin) in
  List.map (fun x -> int_of_string x) (inp_split)

  
let rec pairs : 'a list -> ('a * 'a) list = function
    [] -> []
  | x :: xs -> List.map (fun y -> (x, y)) xs @ (pairs xs)
  
let () =
  let _ = Scanf.sscanf (input_line stdin) "%d" (fun n -> n) in
  let l = i_inp_list () in
  let p = pairs l in
  let ans = List.fold_right(fun (a,b) s -> a * b + s) p 0 
  in
  print_int ans;
  print_newline ()
