function Main(input) {
  const lines = input.split('\n');
  const N = lines[0];
  const A = lines[1].split(' ').map(i => parseInt(i));
  let sum = 0;
  const D = Math.pow(10, 9) + 7;
  for (let i = 0; i < N; i++) {
    for (let j = i + 1; j < N; j++) {
      sum += (A[i] * A[j]) % D;
      if (sum > D) sum = sum % D;
    }
  }
  console.log(sum % D);
}

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