import Foundation

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

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

extension Collection {
    func tuple() -> (Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!)
    }
    func tuple() -> (Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!)
    }
    func tuple() -> (Element, Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!, i.next()!)
    }
    
    func safe(at index: Index) -> Element? {
        self.indices.contains(index) ? self[index] : nil
    }
}

struct DP<Argument: Hashable, Element> {
    var dictionary = [Argument: Element]()
    
    var expression: (Argument, (Argument) -> Element) -> Element
    
    init(expression: @escaping (_ argument: Argument, _ note: (Argument) -> Element) -> Element) {
        self.expression = expression
    }
    
    subscript(_ argument: Argument) -> Element {
        mutating _read {
            if let note = dictionary[argument] {
                yield note
            } else {
                let result = expression(argument) { self[$0] }
                dictionary[argument] = result
                yield result
            }
        }
    }
}

extension Dictionary {
    init(_ initialize: (inout Self) -> ()) {
        var dictionary = Self()
        initialize(&dictionary)
        self = dictionary
    }
}

extension Int {
    var abs: Int {
        self < .zero ? -self : self
    }
}

@propertyWrapper
struct Mod {
    
    let base: Int
    var value: Int
    
    static let defaultBaseNumber = 1_000_000_007
    
    init(_ value: Int, base: Int = defaultBaseNumber) {
        self.base = base
        self.value = value % base
    }
    
    init(wrappedValue: Int, base: Int = defaultBaseNumber) {
        self = .init(wrappedValue, base: base)
    }
    
    var wrappedValue: Int {
        get { return value }
        set { value = newValue % base }
    }
    
    var projectedValue: Int { base }
}

extension Mod: ExpressibleByIntegerLiteral {
    init(integerLiteral value: Int) {
        base = Mod.defaultBaseNumber
        self.value = value % base
    }
}

extension Mod: AdditiveArithmetic {
    static func + (lhs: Mod, rhs: Mod) -> Mod {
        guard lhs.base == rhs.base else { fatalError("not same base") }
        let num = lhs.value + rhs.value
        return Mod(num, base: lhs.base)
    }
    
    static func - (lhs: Mod, rhs: Mod) -> Mod {
        guard lhs.base == rhs.base else { fatalError("not same base") }
        let num = lhs.value - rhs.value
        return Mod(num, base: lhs.base)
    }
}

extension Mod: Numeric {
    init?<T>(exactly source: T) where T : BinaryInteger {
        guard let int = Int(exactly: source) else { return nil }
        self = Mod(int)
    }
    
    var magnitude: Int { value }
    
    static func * (lhs: Mod, rhs: Mod) -> Mod {
        guard lhs.base == rhs.base else { fatalError("not same base") }
        let num = lhs.value * rhs.value
        return Mod(num, base: lhs.base)
    }
    
    static func *= (lhs: inout Mod, rhs: Mod) {
        lhs = lhs * rhs
    }
}


extension Mod: CustomStringConvertible {
    var description: String {
        let _ = base.signum()
        let string = String(format: "%\(9)d", value)
        return "Mod(\(string), base: \(base))"
    }
}

// MARK: ---------------------------------------------------------------------

// import Foundation

let _ = readLine()
let an = readInts().map(Mod.init)

var res = Mod(0)
for i in an.indices {
    let under = an[i]
    for j in 0..<i {
        let upper = an[j]
//        print(under.value, "*", upper.value, "=", (under * upper).value)
        res += under * upper
    }
}
print(res.value)
