main :: IO ()
main = do
  _ <- getLine
  xs <- map read . words <$> getLine
  ys <- map read . words <$> getLine
  let
    xcand = makePair xs
    ycand = makePair ys
  let
    xys = [(abs (x2-x1))*(abs (y2-y1)) | (x1, x2) <- xcand, (y1, y2) <- ycand]
  print $ foldl1 (\x y -> x * y `mod` 1000000007) xys

makePair :: [Integer] -> [(Integer, Integer)]
makePair [] = []
makePair [_] = []
makePair [a, b] = [(a,b)]
makePair (a:rest) =
  map ((,) a) rest ++ makePair rest
