MOD = 1000000007  
N = gets.to_i
a = gets.split.map &:to_i

sum = 0
(0..N-2).each do |i|
  ((i+1)..N-1).each do |j|
    x = a[i] % MOD
    y = a[j] % MOD
    sum += x * y % MOD
  end
end
puts sum % MOD