import scala.io.StdIn._

object Main extends App {

  val n = readInt()
  val A = readLine().split(" ").map(_.toLong)
  def solve() = {
    val mod = (1e9+7).toInt
    (0 until n-1).foldLeft(0L) { (acc, i) =>
      val sum = (i+1 until n).foldLeft(0L) { (accIn, j) =>
        (accIn + A(i) * A(j)) % mod
      }
      (acc + sum) % mod
    } % mod
  }

  println(solve())

}

