program c177

implicit none
integer(16) :: n, ans, i, j
integer(16), allocatable :: a(:)

read *, n
allocate(a(1:n))

read *,  a(:)

ans = 0

do i = 1, n-1
 do j = i+1, n
  ans = ans + mod(a(i) * a(j), 1000000007)
  !print *, a(i) * a(j), mod(a(i) * a(j), 1000000007), ans
 end do
end do

print *, mod(ans,1000000007)

end program c177