let n = Int(readLine()!)!
let divider = 1000_000_000 + 7
let aArray = readLine()!.split(separator: " ").map{Int($0)!}
var sum = 0
for i in 0..<n-1 {
    for j in i+1..<n {
        sum += (aArray[i] * aArray[j]) % divider
        sum %= divider
    }
}
print(sum)

