Scanf.scanf "%s %d" (fun s k ->
    let rec loop i =
        if i + 1 = k then s.[i] else
            if s.[i] = '1' then loop (i + 1)
            else s.[i]
    in
    loop 0 |> Printf.printf "%c\n"
)