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 (index, number) in A.enumerated() {
        for i in (index+1)..<N {
            sum += number * A[i]
        }
    }

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