type Point = (Int,Int)
type Box = (Point,Point)
data Direc = UP | DOWN | LEFT | RIGHT
main = do
    [w,h,n] <- getIntList <$> getLine
    xylist <- get2IntList  n
    putStrLn $ show $ bottom (2 + 2 * max w h) ((0,0),(w,h)) xylist


bottom :: Int -> Box -> [Point] -> Int
bottom _ box [] = boxLength box
bottom minlen box (p:px) =
    let newboxes = filter ((minlen <) . boxLength) $ map (newBox box p) udlr
        newpx = map (\box->filter (insideBox box) px) $ newboxes
    in foldl foldfunc minlen $ zip newboxes newpx

foldfunc :: Int -> (Box,[Point]) -> Int
foldfunc minlen (box,px) = minlen `max` bottom minlen box px

insideBox :: Box -> Point -> Bool
insideBox ((x1,y1),(x2,y2)) (x,y) = inside x1 x2 x && inside y1 y2 y

inside :: Int -> Int -> Int -> Bool
inside l u p = l < p && p < u

udlr :: [Direc]
udlr = [UP,DOWN,LEFT,RIGHT]

newBox :: Box -> Point -> Direc -> Box
newBox (l,(x2,y2)) (_,y) UP    = (l, (x2, y))
newBox ((x1,y1),u) (_,y) DOWN  = ((x1, y), u)
newBox (l,(x2,y2)) (x,_) RIGHT = (l,(x, y2))
newBox ((x1,y1),u) (x,_) LEFT  = ((x, y1), u)

boxLength :: Box -> Int
boxLength ((x1,y1),(x2,y2)) = 2 * ((x2 - x1) + (y2 - y1))

getIntList :: String -> [Int]
getIntList = map read . words

get2IntList :: Int -> IO [(Int,Int)]
get2IntList n = do
    strlist <- sequence $ take n $ repeat getLine
    return $ map ((\[a,b]->(a,b)) . getIntList) strlist
    
