let input = require('fs').readFileSync('/dev/stdin', 'utf8')
// let input = require('fs').readFileSync('./sample_c.txt', 'utf8')
.split(/\n| /)
.slice(0 ,-1)
.map(item => parseInt(item))


const [L, ...numbers] = input
const MOD = 1e9 + 7

let sum = 0
let base = numbers.reduce( (prev, item) => prev + item, 0)

for( let i=0; i<L; i++){
    base -= numbers[i]
    sum += (base * numbers[i]) % MOD
    sum %= MOD
}

console.log(sum)

// const modPow = (x, a) => {
//     if (a === 1) return x
//     if (a % 2 === 1) return (x * modPow(x, a - 1)) % MOD
//     const t = modPow(x, a / 2)
//     return (t * t) % MOD
// }

// console.log(modPow(8, MOD - 2))