"use strict"

function main(input) {
  input = input.split('\n') //.map(v => ~~v)
  const S = input[0]
  const K = parseInt(input[1], 10)

  let res = S.search(/[^1]+/)
  if (res >= 0 && res <= K) console.log(S[res])
  else {
    console.log(1)
  }
  // console.log(S, K)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))