readInt :: String -> Int
readInt = read
x ? (a,b) = if x then a else b

main = do
    s <- map readInt.words<$>getContents
    print $ solve s

solve :: [Int] -> Int
solve = push 2

push 0 _ = 0
push n [a,b] = (a>b) ? (a + push (n-1) [a-1,b], b + push (n-1) [a,b-1])
