
object Main extends App {
  val sosu = 1000000007
  val sc = new java.util.Scanner(System.in) 
  val n = sc.nextInt()
  val a = List.fill(n.toInt)(sc.nextLong())
  val ans = a.combinations(2).foldLeft(0L)((x, y) => (x + y(0) * y(1)) % sosu)
  println(ans)
}