import scala.io.StdIn.{readInt, readLine}

object Main extends App {

  val n = readInt()
  val a = readLine().split(' ').map(_.toLong)

  val sum = (for (i <- 0 until n - 1; j <- i + 1 until n) yield a(i) * a(j)).sum

  println(sum % (math.pow(10, 9) + 7).toLong)
}
