



import collections





def solve():



    S = list(eval(input()))

    K = int(eval(input()))



    for i in range(K):

        if S[i] != "1":

            print((S[i]))

            break

    else:

        print((1))





if __name__ == "__main__":

    solve()





import collections





def solve():



    S = list(eval(input()))

    K = int(eval(input()))



    for i in range(K):

        if S[i] != "1":

            print((S[i]))

            exit()

    print((1))





if __name__ == "__main__":

    solve()

import collections


def solve():
    S = list(eval(input()))
    K = int(eval(input()))
    for i in range(K):
        if S[i] != "1":
            print((S[i]))
            break
    else:
        print((1))


if __name__ == "__main__":
    solve()

import collections


def solve():
    S = list(eval(input()))
    K = int(eval(input()))
    for i in range(K):
        if S[i] != "1":
            print((S[i]))
            exit()
    print((1))


if __name__ == "__main__":
    solve()

-            break -    else: -        print((1)) +            exit() +    print((1))