func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func mainC() {
    let N = readInt()
    let A = readInts()

    var sum = 0
    for i in 0..<N {
        for j in (i+1)..<N {
            sum += A[i] * A[j]
        }
    }

    print(sum % (1000_000_000 + 7))
}
mainC()