local read = io.read

local n = read("n")
local a = {}
for i = 1, n do
	a[i] = read("n")
end

local mod_num = 1000000007
local out = 0
for i = 1, n - 1 do
	for j = i + 1, n do
		local mul = (a[i] * a[j]) % mod_num
		out = (out + mul) % mod_num
	end
end

print(out)
