import numpy as np

S = np.array(list(map(str, input().rstrip())))

K = int(eval(input()))



cnt = 0

ans = 1



for i, s in enumerate(S):

    if s != "1":

        cnt = i+1

        ans = s

        break



if cnt > K:

    print((1))

else:

    print((int(ans)))
s = list(map(str, input().rstrip()))

k = int(eval(input()))



ans = 1

for x in s[:k]:

    if int(x) != 1:

        ans = int(x)

        break

print(ans)
import numpy as np

S = np.array(list(map(str, input().rstrip())))
K = int(eval(input()))
cnt = 0
ans = 1
for i, s in enumerate(S):
    if s != "1":
        cnt = i + 1
        ans = s
        break
if cnt > K:
    print((1))
else:
    print((int(ans)))

s = list(map(str, input().rstrip()))
k = int(eval(input()))
ans = 1
for x in s[:k]:
    if int(x) != 1:
        ans = int(x)
        break
print(ans)

-import numpy as np - -S = np.array(list(map(str, input().rstrip()))) -K = int(eval(input())) -cnt = 0 +s = list(map(str, input().rstrip())) +k = int(eval(input())) -for i, s in enumerate(S): -    if s != "1": -        cnt = i + 1 -        ans = s +for x in s[:k]: +    if int(x) != 1: +        ans = int(x) -if cnt > K: -    print((1)) -else: -    print((int(ans))) +print(ans)