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