program c177

implicit none
integer(8) :: n, ans, i, j
integer(8), 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)
 end do
 
 if(ans > 1000000007) then
  ans = ans - 1000000007
 end if
end do

!print *, mod(ans,1000000007)
print *, ans

end program c177