main = do
  n <- readLn
  xs <- map read . words <$> getLine :: IO [Integer]
  print $ solve n xs

solve n xs = foldl (\x y -> (x + y) `mod` (1000000000 + 7)) 0 $ do
  i <- [1..n-1]
  j <- [i+1..n]
  return $ xs !! (i-1) * xs !! (j-1)