function Main(input) {
  const N = parseInt(input.split("\n")[0])
  const A = input.split("\n")[1].split(" ").map(Number)
  var tmp = 0;
  const mod = 1000000007

  for (i = 0; i < N - 1; i++) {
    for (j = i+1; j < N; j++) {
      tmp = tmp + A[i] * A[j]
    }
  }
  var result = tmp % mod

  console.log(result)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));