import Foundation

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

let N = Int(readLine()!)!
let A = readInt()

var sum = 0
for i in 0...N - 2{
  for j in i + 1...N - 1{
    sum += (A[i] * A[j]) % 1000000007
  }
}
print(sum % 1000000007)