(async () => {
    let input = '';
    for await (const chunk of process.stdin) input += chunk;
    let values = input.split(/\s/);
    
    const length = values.shift();
    values = values.slice(0, length)

    let sum = 0;
    for (let i = 0; i < length; i++) {
        for(let j = i + 1; j < length; j++){
            sum += values[i] * values[j];
        }
    }

    console.log(sum % (1e9 + 7));

})();