object Main extends App{
    val s = scala.io.StdIn.readLine.toList.map(_.toInt - '0'.toInt)
    var t = scala.io.StdIn.readLong

    if(t == 1){
    	println(s(0))
    }else{
    	var i = 0
    	while(i < s.size && s(i) == 1 && i < t){
    		i += 1
    	}
    	println(s(i))
    }
}