let S = readLine()!.characters.map{String($0)}
let K = Int(readLine()!)!
for (i, c) in S.enumerate() {
  if c == "1" {
    if K == i {
      print(c)
      break
    }
  } else {
    print(c)
    break
  }
}  