import qualified Data.ByteString.Char8 as B
import Data.Maybe

value = 10^9+7

main = do
    n <- fst . fromJust . B.readInt <$> B.getLine
    aa <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    print $ flip mod value . sum $ map (answer aa) [(i,j) | i <- [0..n-1], j <- [0..n-1],  i < j]

answer aa (i,j) = (aa!!i * aa!!j) `mod` value