import Control.Monad.Trans.State

main :: IO ()
main = do
  s <- getLine
  n <- readLn
  putChar $ evalState solve (s, n)

solve :: State (String, Int) Char
solve = do
  (c:cs, k) <- get
  if k == 1 || c /= '1'
    then return c
    else put (cs, k - 1) >> solve