require 'bigdecimal'

n = gets.to_i
a = gets.split.map(&:to_i)
sum = 0

(0..n-1).each { |i|
  (i+1..n-1).each { |j|
#    puts "#{a[i]} #{a[j]}"
    sum += (a[i] * a[j]) % 1000000007
    sum %= 1000000007
  }
}
p sum
