((input) => {
  const arr = input.trim().split('\n')[1].split(' ');
  const l = arr.length;
  const n = 1000000007;
  let sum = 0;

  for (let i = 0; i < l - 1; i++) {
    for (let j = i + 1; j < l; j++) {
      sum += arr[i] % n * arr[j] % n;
      sum = sum % n
    }
  }

  console.log(sum);
})(require("fs").readFileSync("/dev/stdin", "utf8"));