fun main(args: Array<String>) {
    val s = readLine()!!
    val k = readLine()!!.toLong()
    val idx = s.indexOfFirst { c -> c != '1' }
    if (idx == -1 || k <= idx) {
        println(1)
        return
    }
    println(s[idx])
}
