import Data.Array.IArray
import Data.List

main = do
  (n:m:_) <- getLine >>= return . map read . words :: IO [Int]
  xs <- getLine >>= return . map read . words :: IO [Integer]
  ys <- getLine >>= return . map read . words :: IO [Integer]

  let
    xslen = fromIntegral $ length xs
    yslen = fromIntegral $ length ys

    x = sum $ map (\i -> (xs!!(fromIntegral $ xslen - 1 - i) - xs!!(fromIntegral i)) * (xslen -1 - 2*i)) [0..div (xslen-1) 2]
    y = sum $ map (\i -> (ys!!(fromIntegral $ yslen - 1 - i) - ys!!(fromIntegral i)) * (yslen -1 - 2*i)) [0..div (yslen-1) 2]

  print $ (x * y) `mod` (10^9+7)
    
