import Control.Applicative
 
main = do
  _ <- getLine
  xs <- map read . words <$> getLine
  ys <- map read . words <$> getLine
  putStr . show . (`mod` 1000000007) . (* 3) $ (x1 - x0) * (y1 - y0)
  where
    x1 = maximum xs
    x0 = minimum xs
    y1 = maximum ys
    y0 = minimum ys