import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val k = sc.nextLong()
    var one = 0
    while(one < s.length && s[one] == '1') one++

    if (k <= one) {
        println(1)
    } else {
        println(s[one])
    }
}