
func main() {
    let N = Int(readLine()!)!
    
    let A = readLine()!.split(separator: " ").map { Int($0)! }

    var S = 0
    for i in 0...N-1 {
        for j in i...N-1 {
            if i != j {
                S = (S + A[i] * A[j]) % 1000_000_007
            }
        }
    }
    
    print(S)
}

main()

