mod = 1_000_000_007

gets
a = gets.split.map &:to_i

tmp0 = a.sum ** 2
tmp1 = a.sum { |e| e ** 2 }
puts (tmp0 - tmp1) / 2 % mod

# tmp0 = a.sum
# tmp0 = ((tmp0 % mod) ** 2) % mod

# tmp1 = a.sum { |e| e ** 2 }

# tmp1 %= mod

# ans = tmp0 < tmp1 ? tmp0 - tmp1 + mod : tmp0 - tmp1

# if ans.odd?
#   puts (ans + mod) / 2
# else
#   puts ans / 2
# end
