object Main extends App{
    val s = scala.io.StdIn.readLine.toList
    val t = scala.io.StdIn.readLong

    var i = 0

    while(i < s.size && s(i) == '1'){
    	i += 1
    }

    if(t <= i){
    	println(1)
    }else{
    	println(s(i))
    }
}
