import io.StdIn.{readInt, readLine}
object Main extends App {
  val n = readInt
  val as = readLine.split(" ").map(_.toInt)

  val divisor = 1000000007L
  var sum = 0L
  for (i <- 0 until n-1) {

    var common_terms_sum = {
      var tmp_sum = 0L
      for (as_j <- as.drop(i+1)) {
        tmp_sum += as_j
        tmp_sum %= divisor
      }
      tmp_sum
    }

    sum += as(i) * common_terms_sum % divisor
    sum %= divisor

  }
  println(sum)

}