import Foundation

func main(input1: String = readLine()!, input2: String = readLine()!) {
    let n = Int(input1)!
    let integers = input2.split(separator: " ").map { Int($0)! }
    
    let m = Int(pow(10.0, 9)) + 7
    var result = 0
    for i in 0..<(n - 1) {
        for j in (i + 1)..<n {
            let ai = integers[i]
            let aj = integers[j]
            result += (ai % m) * (aj % m)
            result = result % m
        }
    }
    print(result)
}

main()