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 numbers = _numbers.map(BigInt)
const MOD = BigInt(1e9 + 7)

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



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

console.log(Number(sum))