
n = gets.to_i
input_str = gets
arr = input_str.split.collect{|l| l.to_i }.combination(2).to_a

calc_arr = arr.collect do |pair|
  (pair[0] * pair[1]) % 1000000007
end

v = calc_arr.inject do |sum, i|
  (sum + i) % 1000000007
end

puts v

