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;
  A.forEach((ai, i) => {
    A.forEach((aj, j) => {
      if (i < j) {
        sum += (ai * aj) % D;
        if (sum > D) sum = sum % D;
      } 
    })
  })
  console.log(sum % D);
}

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