local mod = 1000000007
local function badd(x, y) return (x + y) % mod end
local function bmul(x, y) return (x * y) % mod end
local n = io.read("*n")
local sum = 0
local ret = 0
for i = 1, n do
  local a = io.read("*n")
  ret = badd(ret, bmul(a, sum))
  sum = badd(sum, a)
end
print(ret)