n=gets.chomp.to_i
a=gets.chomp.split.map(&:to_i)

# val = a.combination(2).to_a.map{|v| v.inject(:*) }.sum
val = a.combination(2).to_a
val_len = val.size

max = 0
val.each do |v|
  max += v.inject(:*)
end

p max % (10**9 + 7)