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

K=int(eval(input()))



if S[0]==1:

  if K==1:

    print((1))

  else:

    for i in range(1,len(S)):

      if S[i] != 1:

        print((S[i]))

        exit(0)

      if i == K-1:

        print((1))

        exit(0)

else:

  print((S[0]))
S = eval(input())

K = int(eval(input()))

for x in S:

    x = int(x)

    if x != 1:

        print(x)

        break

    else:

        if K == 1:

            print(x)

            break

        else:

            K -= 1

S = list(map(int, list(eval(input()))))
K = int(eval(input()))
if S[0] == 1:
    if K == 1:
        print((1))
    else:
        for i in range(1, len(S)):
            if S[i] != 1:
                print((S[i]))
                exit(0)
            if i == K - 1:
                print((1))
                exit(0)
else:
    print((S[0]))

S = eval(input())
K = int(eval(input()))
for x in S:
    x = int(x)
    if x != 1:
        print(x)
        break
    else:
        if K == 1:
            print(x)
            break
        else:
            K -= 1

-S = list(map(int, list(eval(input())))) +S = eval(input()) -if S[0] == 1: -    if K == 1: -        print((1)) +for x in S: +    x = int(x) +    if x != 1: +        print(x) +        break -        for i in range(1, len(S)): -            if S[i] != 1: -                print((S[i])) -                exit(0) -            if i == K - 1: -                print((1)) -                exit(0) -else: -    print((S[0])) +        if K == 1: +            print(x) +            break +        else: +            K -= 1