n = gets.chomp.to_i
arr = gets.chomp.split(' ')
arr.map! { |a|
  a.to_i%1000000007
}
i = 0
sum = 0
while i < n
  j = i+1
  while j < n
    # puts arr[i]*arr[j]
    sum += (arr[i]*arr[j])
    sum %= 1000000007 if(sum >= 1000000007)
    j += 1
  end
  i += 1
end
p sum