import re



S = eval(input())

K = int(eval(input()))



m = re.match(r'\A(1+)([1-9]*)\Z', S)

if m:

    print(('1' if len(m.group(1)) >= K else m.group(2)[0]))

else:

    print((S[0]))

import re



S = eval(input())

K = int(eval(input()))



m = re.match(r'\A(1*)([1-9]*)\Z', S)

print(('1' if len(m.group(1)) >= K else m.group(2)[0]))

import re

S = eval(input())
K = int(eval(input()))
m = re.match(r"\A(1+)([1-9]*)\Z", S)
if m:
    print(("1" if len(m.group(1)) >= K else m.group(2)[0]))
else:
    print((S[0]))

import re

S = eval(input())
K = int(eval(input()))
m = re.match(r"\A(1*)([1-9]*)\Z", S)
print(("1" if len(m.group(1)) >= K else m.group(2)[0]))

-m = re.match(r"\A(1+)([1-9]*)\Z", S) -if m: -    print(("1" if len(m.group(1)) >= K else m.group(2)[0])) -else: -    print((S[0])) +m = re.match(r"\A(1*)([1-9]*)\Z", S) +print(("1" if len(m.group(1)) >= K else m.group(2)[0]))