-- Atcoder https://atcoder.jp/contests/abc177/tasks/abc177_c

local n = tonumber(io.read())
local modulo = 10^9 + 7

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

local sum = 0

for i = 1, n do
    for j = i + 1, n do
        sum = (sum + list[i] * list[j]) % modulo
    end
end
print(string.format("%d", sum))