MOD = 10**9 + 7
#puts MOD
count = gets.to_i
numbers = gets.chomp.split.map(&:to_i)

result = 0
numbers.each_with_index {|num, i| 
  # 現在の数字より後
  #puts "num: #{num}"
  nokori = numbers.slice((i+1)..-1)
  #puts "nokori: #{nokori}"
  sum_array = nokori.map{|n| num * n % MOD}
  #puts "sum: #{sum_array}"
  result += sum_array.sum
  }
puts result % MOD