"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n));
    const MOD = 1000000007;
    
    let answer = 0;
    
    for(let i=0; i<N; i++) {
        for(let j=i+1; j<N; j++) {
            // console.log("i;" + A[i]);
            // console.log("j;" + A[j]);
            // console.log("----");
            
            answer += (A[i]) * (A[j]) % MOD;
        }
    }
    
    console.log(answer % MOD);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));