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

var a =  stdin.split("\n")
var s = a[0]
var w= a[1].split(' ').map( str => parseInt(str, 10));
var mod = 1000000007;
//const w = t.split(' ');
//var all = array.reduce(reducer,0)

let total=0;
for (let i=0; i+1<s; i++){
   for(let c=i+1; c<s; c++){
   let sum = w[i]*w[c]
   total=total+sum
  }
}
console.log(total%mod)
