function main(lines) {
  const N = n();
  const as = ba();
  
  let ans = 0n;
  for (let i = 0; i < N-1; i++) {
    for (let j = 1; i+j < N; j++) {
      ans += as[i] * as[i+j];
    }
  }
  ans %= BigInt(1e9+7);
  
  return ans.toString();
}



const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");

let lineCount = 0;
const s = () => lines[lineCount++];
const n = () => Number(s());
const b = () => BigInt(s());
const sa = () => s().split(' ');
const na = () => sa().map(Number);
const ba = () => sa().map(BigInt);
const getLines = (n) => lines.slice(lineCount, lineCount += n);

const ans = main(lines);
console.log( ans );