const input = require("fs").readFileSync("/dev/stdin", "utf8")
const lines = input.split('\n')
let N = lines[0] - 0
let A = lines[1].split(' ').map(Number)

const mod = 1000000007

const sum = [0]
for (let i = 0; i < N; i++)  {
    sum[i + 1] = sum[i] + A[i]
}

let ans = 0
for (let i = 1; i < sum.length - 1; i++) {
    ans += sum[i] * A[i] % mod
}
console.log(ans % mod)
