import Control.Applicative main :: IO () main = solve <$> f >>= print where f = map read <$> words <$> getLine solve :: [Int] -> Int solve [n, m, p, q] = 12 * y + (length . takeWhile (