import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  s <- getLine
  k <- (read::String -> Int) <$> getLine
  if s !! 0 /= '1'
    then putStrLn $ [s !! 0]
    else if k == 1
      then putStrLn "1"
      else putStrLn $ [s !! 1]
