readInteger :: String -> Integer
readInteger = read

main = do
  s <- map readInteger.words<$>getLine
  print $ solve s

solve [badsafe,goodsafe,poison] = goodsafe + ediblepoison where
  ediblepoison = minimum [poison,safes + 1]
  safes = badsafe + goodsafe