from collections import deque

S=deque(list(map(int,list(eval(input())))))

K=int(eval(input()))

i=0

while S:

    if S[0]==1:

        S.popleft()

        i+=1

    else:

        break

result=1 if K<=i else S[0]

print(result)  
S=eval(input())

K=int(eval(input()))

for n in range(min(len(S),K)):

    if S[n]!="1":

        print((S[n]))

        break

else:

    print((1))
from collections import deque

S = deque(list(map(int, list(eval(input())))))
K = int(eval(input()))
i = 0
while S:
    if S[0] == 1:
        S.popleft()
        i += 1
    else:
        break
result = 1 if K <= i else S[0]
print(result)

S = eval(input())
K = int(eval(input()))
for n in range(min(len(S), K)):
    if S[n] != "1":
        print((S[n]))
        break
else:
    print((1))

-from collections import deque - -S = deque(list(map(int, list(eval(input()))))) +S = eval(input()) -i = 0 -while S: -    if S[0] == 1: -        S.popleft() -        i += 1 -    else: +for n in range(min(len(S), K)): +    if S[n] != "1": +        print((S[n])) -result = 1 if K <= i else S[0] -print(result) +else: +    print((1))