input = readlines()
n = input.shift.chomp.to_i
list = input.shift.chomp.split("\s").map{|x| x.to_i}

res = 0
tmp_sum = list[0]
list.each_with_index do |l, i|
  next if i == 0
  res += l * tmp_sum
  if res > 1000000007
    res = res % 1000000007
  end
  tmp_sum += l
end

puts res % 1000000007
