import Data.Int
modNum = 1000000007
toInt64 :: Int -> Int64
toInt64 = (fromInteger :: Integer -> Int64) . toInteger

main = do
  nm <- map (read :: String -> Int64) . words <$> getLine
  inputX <- map (read :: String -> Int64) . words <$> getLine
  inputY <- map (read :: String -> Int64) . words <$> getLine
  putStrLn . show $ solve' ((head nm) - 1) ((last nm) - 1) inputX inputY

solve' :: Int64 -> Int64 -> [Int64] -> [Int64] -> Int64
solve' n m x y = if m > 2 then flip mod modNum $ solve n m x y + solve' n (m-2) x (tail . init $ y)
                          else solve n m x y

solve :: Int64 -> Int64 -> [Int64] -> [Int64] -> Int64
solve n m x y = let xx = (last x) - (head x)
                    yy = (last y) - (head y)
                    area = flip mod modNum $ (flip mod modNum $ n * m) * (flip mod modNum $ xx * yy)
                    in if n > 2 then flip mod modNum $ area + solve (n-2) m (tail . init $ x) y
                            else area
