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