n=eval(input())

k=int(eval(input()))

counter=0

nex=0

for i in range(len(n)):

  if n[i]=='1':

    counter+=1

  else:

    nex=n[i]

    break

if nex==0:

  nex='1'

if k>counter:

  print(nex)

else:

  print((1))
import sys

s=eval(input())

k=int(eval(input()))

for i in range(min(len(s),k)):

  if s[i]!='1':

    print((s[i]))

    sys.exit()

print((1))
n = eval(input())
k = int(eval(input()))
counter = 0
nex = 0
for i in range(len(n)):
    if n[i] == "1":
        counter += 1
    else:
        nex = n[i]
        break
if nex == 0:
    nex = "1"
if k > counter:
    print(nex)
else:
    print((1))

import sys

s = eval(input())
k = int(eval(input()))
for i in range(min(len(s), k)):
    if s[i] != "1":
        print((s[i]))
        sys.exit()
print((1))

-n = eval(input()) +import sys + +s = eval(input()) -counter = 0 -nex = 0 -for i in range(len(n)): -    if n[i] == "1": -        counter += 1 -    else: -        nex = n[i] -        break -if nex == 0: -    nex = "1" -if k > counter: -    print(nex) -else: -    print((1)) +for i in range(min(len(s), k)): +    if s[i] != "1": +        print((s[i])) +        sys.exit() +print((1))