import Control.Applicative main = do [x, y] <- map read . words <$> getLine [x2, y2] <- map read . words <$> getLine print $ if (x == y && x2 == y2 && abs x > abs x2 && abs y > abs y2) then x + 1 else max x y