main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  xs <- map read . words <$> getLine
  ys <- map read . words <$> getLine
  let
    f xs n k =
      fromIntegral $ (k-1)*xk - (n-k)*xk
      where
        xk = xs !! (k-1)
    xsum = sum . map (f xs n) $ [1..n]
    ysum = sum . map (f ys m) $ [1..m]
  print $ xsum * ysum `mod` 1000000007
