let n = Int(readLine()!)!
let a = readLine()!.split(separator:" ").map{Int($0)!}
let mod = 1000000007
var s = 0
for i in 0..<n-1 {
  var s1 = 0
  for j in i+1..<n {
    s1 += a[j]
  }
  s = (s + a[i] * s1) % mod
}
print(s)