n = gets.to_i
a = gets.split(" ").map(&:to_i)
sum=0
for i in 0..n-2
  sum_tmp=0
  for j in (i+1)..n-1
    sum_tmp+=a[j]%(1000000007)
  end
  sum_tmp=sum_tmp
  sum=(sum+a[i]*sum_tmp)%(1000000007)
end
sum=sum%(1000000007)

puts sum
