gets
mod = (10 ** 9) +7
a_array = gets.split(' ').map(&:to_i).map{|ele| ele % mod }
sum = a_array.inject(:+)
ans = 0

a_array.each do |ele|
  sum -= ele

  ans += (ele * sum) % mod
end

puts ans % mod
