const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

n = rl.question("", (num) => return Number(num))
p = rl.question("", (num) => return num.split())
product = 0
for(int i = 0; i<n; i++){ 
    for(int j = i; j<=n; j++){ 
        product = product + Number(p[i])*Number(p[j]) 
    }
}
print(product % (10**9 + 7))