

object Main extends App {
  val N = io.StdIn.readLine.toInt

  val param = io.StdIn.readLine.split(" ").map(_.toLong)

  val ret = (0 to param.length - 1).foldLeft(0l) { (acc, v) =>
    val ret = (v + 1 to param.length - 1).foldLeft(0l) { (acc2, w) => 
      (acc2 + ((param(v) * param(w)) % (1000000000 + 7))) % (1000000000 + 7)
    }
    (ret + acc) % (1000000000 + 7)
  }

  println(ret)

}

