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

const [L, ...numbers] = input


let sum = 0
for( let i=0; i<L; i++){
    for( let j=1; j<L-i; j++){
        sum += (numbers[i] * numbers[i+j]) % 1000000007
    }
    if(sum > 1000000007)sum = sum % 1000000007
}

console.log(sum)