S = input()
K = int(input())
c1 = 0
ans = S[0]
for i, s in enumerate(S):
    if s != '1':
        ans = s
        break
    c1 = i + 1
if c1 >= K:
    print(1)
else:
    print(ans)

33787c624468cbcdb216e498177f87e80d57a122
<mask token>

<mask token>
for i, s in enumerate(S):
    if s != '1':
        ans = s
        break
    c1 = i + 1
if c1 >= K:
    print(1)
else:
    print(ans)

S = input()
K = int(input())
c1 = 0
ans = S[0]
for i, s in enumerate(S):
    if s != '1':
        ans = s
        break
    c1 = i + 1
if c1 >= K:
    print(1)
else:
    print(ans)
