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;
  

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