import Control.Applicative
 
main = do
  _ <- getLine
  xs <- map read . words <$> getLine
  ys <- map read . words <$> getLine
  putStr . show . (`mod` 1000000007) . sum $ [area x y x' y' | x <- xs, y <- ys, x' <- xs, y' <- ys, x > x', y > y']
 
area x y z w = mod ((x - z) * (y - w)) 1000000007