N = gets.to_i
As = gets.split.map &:to_i

MOD = 10**9 + 7

ans = 0
(N-1).times do |i|
    a = As[i]
    ((i+1)..(N-1)).each do |j|
        ans += (a * As[j]) % MOD
        ans %= MOD
    end
end

p ans