module Main where

mkCombiDist :: [Int] -> [Int]
mkCombiDist [] = []
mkCombiDist al@(a:as) = foldr (\x acc -> (x-a):acc) (mkCombiDist as) as

sumSize :: [Int] -> [Int] -> Int
sumSize [] _ = 0
sumSize _ [] = 0
sumSize (a:as) ab = foldr (\x acc -> acc+(x*a)) (sumSize as ab) ab

main = do
    l1 <- getLine
    xs <- (map read.words) <$> getLine
    ys <- (map read.words) <$> getLine

    print $ (flip mod 1000000007) $ sumSize (mkCombiDist xs)  (mkCombiDist ys)
