N = gets.chomp.to_i
ary = gets.chomp.split(" ").map(&:to_i)
amari = []
mod = (10**9 + 7)

ary.each_with_index do |a,i|
  j = i + 1
  while j <= (ary.length - 1) do
    one = a % mod
    two = ary[j] % mod
    three = (one * two) % mod
    amari << three
    j += 1
  end
end

puts (amari.sum ) % mod
