n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
mod = 1000000007

i = 0
sum = 0
each_sum = 0
while i < n-1
  each_sum += arr[i]
  sum += arr[i+1] * each_sum 
  # p "i:#{i}, each_sum:#{each_sum}, sum:#{sum}"
  i += 1
end
p sum%mod