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

//console.log(stdin)
var a =  stdin.split("\n")
var s = a[0]
//var array = []
var t = a[1]
//console.log(t)

const w = t.split(' ');
//console.log(w)

//総当たり方式


//
let total=0;
//配列からの取り出し
for (let i=0; i+1<s; i++){
  let target = w[i]
  //console.log(target)
   for(let c=i+1; c<s; c++){
   let sum = target*w[c]
   total=total+sum

  }

}
 console.log(total%(10**9+7))
