import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
main = breadIs >>= main'
    where
        main' [n, m] = replicateM 2 breadIs >>= print . solve n m

solve :: Int -> Int -> [[Int]] -> Int
solve n m [xs, ys] = modval $ calc n xs * calc m ys

calc :: Int -> [Int] -> Int
calc n = foldl' ff 0 . zip [0..]
    where
        ff acc (i, x) = modval $ acc + modval ((2 * i - n + 1) * x)


modval :: Int -> Int
modval = (`mod` mv)

mv :: Int
mv = 7 + 10 ^ 9


breadIs :: IO [Int]
breadIs = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)
