let n = Scanf.scanf " %d" (+) 0
let ds = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let ans = ref 0
let _ = Array.iteri (fun i d -> for j = i + 1 to n - 1 do ans := !ans + d * ds.(j) done) ds; Printf.printf "%d\n" !ans