s = eval(input())

k = int(eval(input()))



import random

for i, v in enumerate(s):

    if v != "1":

        break

after = "1" * i + v * 100

print((after[min(len(s), k) - 1]))

s = eval(input())

k = int(eval(input()))



if k <= len(s) and s[:k] == "1" * k:

    print("1")

else:

    for i in s:

        if i != "1":

            print(i)

            break

s = eval(input())
k = int(eval(input()))
import random

for i, v in enumerate(s):
    if v != "1":
        break
after = "1" * i + v * 100
print((after[min(len(s), k) - 1]))

s = eval(input())
k = int(eval(input()))
if k <= len(s) and s[:k] == "1" * k:
    print("1")
else:
    for i in s:
        if i != "1":
            print(i)
            break

-import random - -for i, v in enumerate(s): -    if v != "1": -        break -after = "1" * i + v * 100 -print((after[min(len(s), k) - 1])) +if k <= len(s) and s[:k] == "1" * k: +    print("1") +else: +    for i in s: +        if i != "1": +            print(i) +            break