n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)
sum = 0
for i in 0..(n-2)
    for j in (i+1)..(n-1)
        sum += (arr[i] * arr[j]) % ((10**9) + 7)
        sum %= ((10**9) + 7)
    end
end
puts sum