import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Control.Monad
import Data.List

main :: IO ()
main = do
  [w, h] <- map read . words <$> getLine
  p <- replicateM w $ do
    p1 <- fst . fromJust . BS.readInt <$> BS.getLine
    return (True, p1)
  q <- replicateM h $ do
    q1 <- fst . fromJust . BS.readInt <$> BS.getLine
    return (False, q1)
  let
    r = sortOn snd $ p ++ q
    solve _ [] = 0
    solve (x, y) ((b, c):l) = if b
      then (h+1-y)*c + solve (x+1, y) l
      else (w+1-x)*c + solve (x, y+1) l
  print $ solve (0, 0) r
