import Control.Monad
import Data.List
import Data.Maybe

main = do
  s <- getLine
  k <- readLn
  putChar $ solve s k

solve :: String -> Integer -> Char
solve (c : s) k
  | k == 1 = c
  | c /= '1' = c
  | otherwise = solve s (k - 1)