fun main(args: Array<String>) {
    val S = readLine()!!
    val K = readLine()!!.toLong()

    val k = S.indexOfFirst { it != '1' }
    if (k < 0 || K <= k) {
        println('1')
    } else {
        println(S[k])
    }
}
