let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  const len = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => BigInt(n));
  const MOD = BigInt(1e9 + 7);
  let sum = BigInt(0);

  function mul(a, b) {
    return ((BigInt(a) % MOD) * (BigInt(b) % MOD)) % MOD;
  }

  for (let i = 0; i < len - 1; i++) {
    for (let j = i + 1; j < len; j++) {
      sum += mul(arr[i], arr[j]);
    }
  }
  console.log(Number(sum % MOD));
}
