import java.util.Scanner

import scala.collection.mutable.ArrayBuffer

object Main extends App {

  val sc = new Scanner(System.in)
  val n = sc.nextInt()
  sc.nextLine()
  val d = sc.nextLine().split(" ").map(_.toInt)

  private val array: ArrayBuffer[Int] = ArrayBuffer.empty[Int]

  d.zipWithIndex.foreach { case (dn, i) => (i + 1 until d.length).foreach(j => array += dn * d(j)) }

  println(array.sum)
}
