import scala.io.StdIn._

object Main extends App {

  val n = readInt()
  val A = readLine().split(" ").map(_.toLong)
  def solve() = {
    val mod = (1e9+7).toInt
    val aLen = A.length
    var ans = 0L
    for {
      i <- 0 until aLen
      j <- i+1 until aLen
    } {
      ans += (A(i) * A(j)) % mod
    }
    ans % mod
  }

  println(solve())

}

