fun main(args: Array<String>) {
    val n = readLine()!!.map { it.toLong() }.first()
    val ds = readLine()!!.split(" ").take(n.toInt()).map { it.toLong() }.toList()

    val sum = ds.mapIndexed { i, dx ->
        ds.drop(i+1).map { dy ->
            dx * dy
        }.sum()
    }.sum()

    print(sum);
}