main = do
  [_,_] <- map read.words <$> getLine :: IO [Integer]
  xs <- map read.words <$> getLine :: IO [Integer]
  ys <- map read.words <$> getLine :: IO [Integer]
  let xrs = sum [xr-xl|xl<-init xs,xr<-tail xs,xr>xl]
      yrs = sum [yt-yb|yb<-init ys,yt<-tail ys,yt>yb]
  print $ (`mod`1000000007) $ xrs*yrs
