f2::Char -> String
f2 x=take 1 $ tail $ show x

f::Int->String->String
f 0 (x:xs)=f2 x
f n ('1':xs)=f (n-1) xs
f n (x:xs)=f2 x 

main = do
       a<-getLine
       b<-getLine
       let k=read b::Int-- your code goes here
       putStrLn $ (f (k-1) a)