function Main(input) {
    input = input.split("\n");
    const n = parseInt(input[0], 10);
    const a = input[1].split(" ").map(v => parseInt(v, 10));

    let total = 0;
    const mod = 10 ** 9 + 7;
    for(let i = 0; i < n-1; i++) {
        for(let j = i + 1; j < n; j++) {
            total += a[i] * a[j] % mod;
        }
    }
    total %= mod;

    console.log(total);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));