import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.next()
  val k = sc.nextLong()

  var all = true
  val tmp = s[0]
  for (c in s) {
    if (c != tmp) {
      all = false
    }
  }
  if (all) {
    println(s[0])
    return
  }


  if (s.length == 1) {
    println(s)
    return
  }

  var index = -1
  var notOne = '0'
  for (i in 0 until s.length) {
    val c = s[i]
    if (c != '1') {
      index = i
      notOne = c
      break
    }
  }

  if (k < index.toLong() + 1L) {
    println(1)
  } else {
    println(notOne)
  }
}