function Main(input) {
  input = input.split("\n");
  const N = parseInt(input[0], 10);
  const A = input[1].split(" ").map(n => parseInt(n, 10));

  var count = 0;
  var sum = 0;

  A.forEach(function(a) {
    sum += a;
  });

  for(var i = 0; i < (N-1); i++){
    sum-=A[i]
    count+=(A[i]*sum)
  }
  
  console.log(count%1000000007);
  
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));