import Control.Monad
import Data.List
main = getLine >>= main' . fmap read . words
    where
        main' [n, m] = replicateM 2 getLine >>= print . solve n m . fmap (fmap read . words)

solve :: Integer -> Integer -> [[Integer]] -> Integer
solve n m [xs, ys] = sumf n xs * sumf m ys `mod` modm
    where
        sumf c = foldl' (\acc (i, x) -> (acc + x * (2 * i - c - 1)) `mod` modm) 0 . zip [1..]

modm :: Integer
modm = 7 + 10 ^ 9
