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

  var count = 0;

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