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

var a =  stdin.split("\n")
var s = a[0]
var t= a [1]
var mod = 10**9+7
const w = t.split(' ');
var data = []

let total=0;
for (let i=0; i+1<s; i++){
   for(let c=i+1; c<s; c++){
   let target = w[i]
   let sum = target*w[c]
   data.push(sum)
  }
}
var result = data.reduce(function(a, x){return a + x;});
console.log(result%mod)
