let solve s i =
  let rec find_aux s i cur = match String.get s (cur-1) with
    | '1' when i > cur -> find_aux s i (cur+1)
    | '1' when i = cur -> '1'
    | x -> x
  in
  find_aux s i 1


let () =
  let rec read () =
    try let ans = (Scanf.scanf "%s\n%i\n" solve) in
        Printf.printf "%c\n" ans
    with End_of_file -> ()
  in
  read ()
;;
