N = gets.chomp.to_i
ary = gets.chomp.split(" ").map(&:to_i)
amari = []

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

puts (amari.sum ) % (10**9 + 7)
