peterverebics/CodeNet_Python_118 huggingface dataset:
S = [int(i) for i in input()]
K = int(input())

ans = 1
if K<=len(S):
    for i in S[:K]:
        if i!=1:
            ans=i
            break
else:
    for i in S:
        if i!=1:
            ans=i
            break
print(i)
s = str(input())
k = int(input())


for i in range(k):
    if s[i] != "1" :
        break
print(s[i])
s = input()

k = int(input())

ichi = 0
for i in s:
    if int(i) == 1:
        ichi = ichi +1
    else:
        break


if ichi >= k:
    print(1)
else:
    print(s[ichi])
# Problem C - To Infinity

# input
S = list(input())
s_len = len(S)
K = int(input())

# initialization
pos = 0
while K>0:
    K -= 1
    if int(S[pos])==1:
        pos += 1
    else:
        K += 1
        break
    if pos==s_len:
        pos -= 1
        break

# output
if K==0:
    print(S[pos-1])
else:
    print(S[pos])
S=input()
k=int(input())
for i in range(min(len(S),k)):
    if S[i] != '1':
        print(S[i])
        break
else:
    print(1)
s=input()
k=int(input())

tmp=len(s)
for i in range(len(s)):
    if s[i]!='1':
        tmp=i
        num=s[i]
        break
if k>tmp:
    print(num)
else:
    print('1')
# 2^5000000000000000 > 10^135
S = list(input())
K = int(input())
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
    elif i == K - 1:
        print('1')
        exit()
s = input()
k = int(input())

c1 = 0
num = ""
for c in s:
    if c == "1":
        c1 += 1
    else:
        num = c
        break

if k <= c1:
    print("1")
else:
    print(num)
s = input()
k = int(input())
flag = False
 
for i in range(min(len(s), k)):
    if s[i] != '1':
        ans = int(s[i])
        flag = True
        break

if flag == True:
    print(ans)
else:
    print(1)
S = input()
K = int(input())
ans = 1
for i, s in enumerate(S):
    if i+1 == K:
        ans = s
        break
    if s == '1':
        continue
    else:
        ans = s
        break

print(ans)
def main():
    s = input()
    k = int(input())
    ans = 0
    tyou = 500000000000000
    for v in s:
        if v == '1':
            ans += 1
        else:
            ans += tyou ** int(v)
        if ans >= k:
            print(v)
            exit()


if __name__ == '__main__':
    main()
if __name__ == '__main__':
    S=list(input())
    K=int(input())
    S=[int(s) for s in S]
    for i in range(K):
        if S[i]!=1:
            print(S[i])
            break
        else:
            if i==K-1:
                print(1)
S = input()
K = int(input())

ones = 0
inf = None
for c in S:
    if c=='1':
        ones += 1
    else:
        inf = c
        break

if K <= ones:
    print('1')
else:
    print(inf)
s = input()
k = int(input())

for i in range(k):
    if s[i] != "1":
        print(s[i])
        exit()
    
print(1)
s = input()
k = int(input())
ok = True
char = '1'
for i in range(k):
	if s[i] != '1':
		ok = False 
		char = s[i]
		break
if ok:
	print(1)
else:
	print(char)
def resolve():
    s=input()
    K=int(input())
    for i in s:
        if i!='1':
            print(i)
            break
        else:
            if K==1:
                print(1)
                break
            K-=1
        



if __name__ == "__main__":
    resolve()
s = input()
k = int(input())

limit = min(100, k)

ans = 1
for i in range(limit):
    if s[i] != '1':
        ans = s[i]
        break

print(ans)
s = input()
k = int(input())

if k == 1 or len(s) == 1:
    ans = list(s)[0]
else:
    ans = None
    for i, j in enumerate(list(s)):
        if i < k-1:
            if j != '1':
                ans = j
                break
        elif i == k-1:
            ans = j           
            break
        else:
            continue
print(ans)
s=input()
k=int(input())
ans,bns=0,0
for i in range(len(s)):
    if s[i]!="1":
        ans=s[i]
        break
    else:
        bns+=1 #0の連続
if k<=bns: #k=何番目
    print(1)
else:
    print(ans)
s = str(input())
k = int(input())

res = 1
idx = 0
for i in range(len(s)):
    if s[i] != "1":
        res = s[i]
        idx = i + 1
        break

if k < idx:
    print(1)
else:
    print(res)
S = input()
K = int(input())

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

print(ans)
s =input()
n = len(s)
k = int(input())

for i in range(k):
    if s[i] == '1':
        continue
    else:
        print(int(s[i]))
        break
else:
    print(1)
S = list(str(input()))
K = int(input())

ind = 0
for s in S:
    i = int(s)

    if i == 1:
        num = pow(i, 5000000000000000)
        if num + ind >= K:
            print(i)
            break
        else:
            ind += num
    else:
        print(i)
        break
s = input()
k = int(input())

cnt = 0
for c in s:
    if c == '1':
        cnt += 1
    else:
        print(c)
        break

    if cnt >= k:
        print(c)
        break
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    s = input()
    k = int(input())

    ichi = 0
    for i in range(len(s)):
        if s[i] == '1':
            ichi += 1
        else:
            break
    if ichi >= k:
        print(1)
    else:
        print(s[ichi])



if __name__ == '__main__':
  main()
S = str(input())
K = int(input())

if len(S) == 1:
        print(S[0])
        exit(0)

i = 0
while S[i] == '1' and i <= len(S)-2:
        if K <= i + 1:
                print(S[i])
                exit(0)
        i += 1
print(S[i])
s = input()
k = int(input())

ans = '1'

if s.count('1') == len(s) or k == 1 and s[k-1] == '1':
    print(1)
else:
    for i in range(k):
        if s[i] != '1':
            ans = s[i]
            break
    print(ans)
S = input()
K = int(input())
one = 0

for char in S:
    if char == "1":
        one += 1
    else:
        break

if K <= one:
    print(1)
elif one > 0:
    print(S[one])
else:
    print(S[0])
S = input()
K = int(input())
n = 0
if K <= len(S) and all([s == '1' for s in S[:K]]):
  print('1')
else:
  for s in S:
    if s != '1':
      print(s)
      exit()
s=input()
k=int(input())
for i in range(len(s)):
    if s[i]=="1":
        k-=1
    else:
        k-=int(s[i])*(5*10**18)
    if k<=0:
        print(s[i])
        exit()
S = input()
K = int(input())

output = ''

if len(S) <= K:
    for letter in S:
        if letter != '1':
            output = letter
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break

if output:
    print(output)
else :
    print('1')
S = input()
K = int(input())

idx = min(K, len(S))
for s in S[:idx]:
    if s != "1": 
      print(s)
      break
else:
  print(1)
s=input()
for i in range(int(input())):
  if s[i]!='1': print(s[i]);break
else:
  print(1)
import sys
import math

s=input()
k = int(input())
cnt = False
ans=0
for i in range(0,k):
    if s[i] != '1':
        ans = s[i]
        cnt = True
        break
if (not cnt):
    print(1)
else:
    print(ans)
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    k=int(input())
    for i in range(min(100,k)):
        if s[i]!='1':
            print(s[i])
            break
    else:print(1)

if __name__=='__main__':
    main()
S = input()
K = int(input())
for i in range(min(len(S), K)):
  if(S[i] != '1' and S[i] != '0'):
    print(int(S[i]))
    exit()
print(1)
s = list(input())
k = int(input())
for i in range(len(s)):
  if s[i] != "1":
    break
if k-1 < i:
  print("1")
else:
  print(s[i])
def main(s: str, k: int):
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            return

    print(1)


if __name__ == "__main__":
    s = input()
    k = int(input())

    main(s, k)
import sys

s = input()
k = int(input())

for n in s[:k]:
    if int(n) > 1:
        print(n)
        sys.exit()
print(1)
def main():
    s = input()
    k = int(input())

    m = 0
    ans = ""

    for i in range(len(s)):
        if s[i] != "1":
            m = i+1
            ans = s[i]
            break
    
    if k < m:
        print(1)
    elif m == 0:
        print(1)
    else:
        print(int(ans))



if __name__ == "__main__":
    main()
s=input()
k=int(input())
for i in range(k):
  if not s[i]=='1':
    print(s[i])
    break
else:
  print(s[k-1])
S=input()
K=int(input())
for i in range(min(len(S),K)):
  if S[i]>="2":
    print(S[i])
    exit()
print("1")
s = input()
k = int(input())

for i in range(len(s)):
    if s[i] == "1":
        if i+1 == k:
            print(1)
            break
    else:
        print(s[i])
        break
import sys, math
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
s = lines.pop(0)
k, = [int(num) for num in lines.pop(0).split(" ")]
days = 5000 * (10 ** 12)
for n in s:
    log_k = math.log10(k)
    n = int(n)
    log_n_days = math.log10(n) * days
    if log_k > log_n_days:
        k -= n ** days
    else:
        break
print(n)
import collections


def solve():

    S = list(input())
    K = int(input())

    for i in range(K):
        if S[i] != "1":
            print(S[i])
            break
    else:
        print(1)


if __name__ == "__main__":
    solve()
S = input()
K = int(input())
lc1 = -1
while lc1 + 1 < len(S) and S[lc1 + 1] == '1':
    lc1 += 1

print("1" if lc1 + 1 >= K else S[lc1 + 1])
s=input()
k=int(input())

for i in range(k):
	if s[i]!="1":
		print(s[i])
		break
else:
	print("1")
a = input()
k = int(input())
count = 1
for i in a:
  if i != "1":
    break
  count += 1
if k >= count:
  print(a[count-1])
else:
  print("1")
s = str(input())
k = int(input())
i, count = 0, 0
while (i < len(s)):
  if int(s[i]) == 1:
    if (count >= k - 1):
      print('1')
      break
    count += 1
  else:
    print(s[i])
    break
  i += 1
s = input()
k = int(input())

for i, v in enumerate(s):
  if i == k-1:
      print(v)
      exit()
  elif v != "1": 
      print(v)
      exit()
S=input()
K=int(input())

for i in range(K):
    if S[i]!='1':
        break;

print(S[i])
S = input()
K = int(input())

for i in range(K):
    c = S[i]
    if c != '1':
        print(c)
        break
else:
    print(1)
s = input()
k = int(input())
i = 0
while True:
  if s[i] == '1':
    if k <= i+1:
      print('1')
      break
    else:
      i += 1
  else:
    print(s[i])
    break
s = str(input())
k = int(input())
if k <= len(s) and s[:k] == '1' * k:
  ans = 1
else:
  ans = s.replace('1', '')[0]
print(ans)
S = input()
K = int(input())

for i in range(len(S)):
    if S[i] != "1":
        print(S[i])
        break
    else:
        if i == K - 1:
            print("1")
            break
s = list(input())
k = int(input())

for i in range(min(k,len(s))):
    if s[i] != '1':
        print(s[i])
        exit(0)

print(1)
S=str(input())
K=int(input())

first_number=1
location=0
for i in range(len(S)):
  if int(S[i]) != 1:
    first_number = S[i]
    location = i
    break
if K <= location:
  print(1)
else:
  print(first_number)
s = input()
k = int(input())
for i in range(len(s)):
    if s[i] == "1":
        k -= 1
    else:
        k-=10**19
    if k <= 0:
        print(s[i])
        break
S = input()
K = int(input())

ans = '1'
k = 0
for s in S:
    if s == '1':
        k += 1
        if k >= K:
            ans = '1'
            break
    else:
        ans = s
        break

print(ans)
import sys
s = str(input())
n = int(input())
i = 0
while True:
    if int(s[i]) == 1:
        if (n-1) == i:
            print("1")
            sys.exit()
        else:
            i += 1
    else:
        print(s[i])
        sys.exit()
s = input()
k = int(input())
f = True
for si in s[:k]:
    if si != "1":
        print(si)
        f = False
        break
if f: print("1")
s = input()
k = int(input())

if s[0] != "1":
    print(s[0])
    exit()
else:
    cnt = 0
    not_1 = 0
    for i in range(len(s)):
        if s[i] == "1":
            cnt += 1
        else:
            not_1 = i
            break
    if cnt >= k:
        print(1)
        exit()
    else:
        print(s[not_1])
import sys
s=input()
k=int(input())
for i in range(k):
  if s[i]!='1':
    print(s[i])
    sys.exit()
print(1)
import sys
def input(): return sys.stdin.readline().strip()

def main():
    S = input()
    K = int(input())

    for i in range(K):
        n = int(S[i])
        if n != 1:
            print(n)
            return
    print(1)


if __name__ == "__main__":
    main()
s = input()
k = int(input())

for i in range(0,k):
    if s[i] != '1':
        print(s[i])
        exit()
print(s[0])
def main():
    S  = input()
    K  = int(input())

    cnt = 0
    while cnt<len(S) and  S[cnt]=='1':
        cnt = cnt + 1
    
    if K<=cnt:
        print(S[0])
    elif cnt==len(S):
        print(S[cnt-1])
    else:
        print(S[cnt])


if __name__ == '__main__':
    main()
S = input()
K = int(input())
flag = False
if set(S[:K]) == set(['1']):
    print(1)
else:
    for i in range(K):
        if S[i] != '1':
            print(S[i])
            break
S=input()
K=int(input())

if K==1:
    print(S[0])
else:
    for i,s in enumerate(S):
        if i==K-1:
            print(s)
            exit()
        if s!="1":
            print(s)
            exit()
#!/usr/bin/env python3

s = str(int(input()))
k = int(input())


for i in range(k):
    if s[i] != "1":
        print(s[i])
        exit()

print(s[i])

# if s[0] == "1":
#     if k == 1:
#         print(1)
#     else:
#         print(s[1])
# else:
#     print(s[0])
s = input()
k = int(input())
cnt = 0
for j in range(len(s)):
	cnt += 1
	if s[j] == "1":
		if cnt == k:
			print("1")
			exit()
	else:
		print(s[j])
		exit()
s = input()
k = int(input())
for i in range(k):
    if s[i] != '1':
        print(s[i])
        exit()
print(1)
def main():
    S = input()
    k = int(input())
    for s in S[:k]:
        if s != '1':
            print(s)
            break
    else:
        print(1)


if __name__ == '__main__':
    main()
S=input()
K=int(input())
i=0
while S[i]=='1' and K>i+1 and i<len(S):
  i+=1
if i==len(S):
  i=0
print(S[i])
s = str(input())
k = int(input())
len_s = len(s)
cnt_1 = 0
for i in range(len_s):
    if s[i] == '1':
        cnt_1 += 1
    else:
        moji = s[i]
        break
if cnt_1 >= k:
    print(1)
else:
    print(s[i])
import sys
S = input()
K = int(input())
if len(S) == 1:
  print(S)
  sys.exit(0)
if K == 1:
  print(S[0])
  sys.exit(0) #
i = 0
while i<len(S):
  if S[i] == '1':
  	i += 1
  else:
    break
if i < len(S):
  keep = S[i]
else:
  keep = S[i-1]
if K <= i:
  print('1')
  sys.exit(0)
else:
  if S[0] != '1':
    print(S[0])
  else:
	  print(keep)
s=list(input())
k=int(input())
ans='1'
for i in range(k):
  if s[i]=='1':
    continue
  else:
    ans=s[i]
    break
print(ans)
S = input()
K = int(input())

T = "N"
for i in range(len(S)):
  if S[i] != "1":
    T = "Y"
    k = i+1
    x = int(S[i])
    break
if T == "N":
  print(1)
else:
  if K < k:
    print(1)
  else:
    print(x)
s = list(str(input()))
k = int(input())
ans = '1'

for i in range(k):
  if s[i] != '1':
    ans = s[i]
    break
  if len(s)-1 == i:
    break
    
print(int(ans))
s = input().rstrip()
n = int(input().rstrip())

if s[:n].count('1') == n:
    print(1)
else:
    print(s.replace('1', '')[0])
S = input().strip()
ind = -1
for i in range(len(S)):
    if S[i]=="1":
        ind = i
    else:break
K = int(input())
ind += 1
if K<=ind:
    print(1)
else:
    print(S[ind])
import re

S = input()
K = int(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 = input()
K = int(input())

m = re.match(r'\A(1*)([1-9]*)\Z', S)
print('1' if len(m.group(1)) >= K else m.group(2)[0])
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()

def resolve():
    import sys
    input = sys.stdin.readline

    s = input().rstrip()
    k = int(input().rstrip())

    for i in range(k):
        if s[i] != "1":
            print(s[i])
            return

    print(1)


if __name__ == "__main__":
    resolve()
s=input()
k=int(input())
pos=-1
for i in range(len(s)):
    if(s[i]!='1'):
        pos=i;break;
if(pos==-1 or k<pos+1):
    print(1);exit()
print(s[pos])
s = input().rstrip()
k = int(input())

c = '1'
for i in range(min(len(s), k)):
    if s[i] != '1':
        c = s[i]
        break
print(c)
S=input()
K=int(input())
tmp = 0
for i in S:
    if i=='1':
        tmp += 1
    else:
        break
if K <= tmp:
    print(1)
else:
    print(S[tmp])
s=input()
li=list(set([s[i] for i in range(len(s))]))
k=int(input())
c=0
for i in range(len(s)):
  if s[i] != "1":
    t = s[i]
    j=i
    c=1
    break
if c==0:
  print(1)
else:
  if j<=k-1:
    print(t)
  else:
    print(1)
S = input()
K = int(input())

ans = "1"
for i in range(K):
    if S[i] != "1":
        ans = S[i]
        break

print(ans)
S=input()
K=int(input())
for i in range(len(S)):
  if i==K-1:
    print(S[i])
    exit()
  if S[i]!="1":
    print(S[i])
    exit()
print(1)
s = input()
k = int(input())
for i in range(min(len(s), k)):
  if not s[i] == '1':
    print(s[i])
    break
else:
  print(1)
S=list(input())
S=list(map(int,S))
K=int(input())

i=0
while i<K:
    if S[i]>1:
        ans=S[i]
        break
    else:
        ans=1
        i+=1
print(ans)
S = input()
K = int(input())
 
for i, s in enumerate(S, 1):
  if s == '1':
    if i == K:
      print(s)
      break
    else:
      continue
  else:
    print(s)
    break
c = 5*pow(10, 14)
list_N = list(input())
k = int(input())
cnt = 0
ans = 0

for i in list_N:
    i = int(i)
    if i != 1:
        ans = i
        break
    else:
        cnt += 1
        if cnt == k:
            ans = 1
            break

print(ans)
import sys
def input():
  return sys.stdin.readline().rstrip()

S=input()
K=int(input())

ichi=0
for i in range(len(S)):
  if S[i]=="1":
    ichi+=1
  else:
    break

print(1 if K<=ichi else S[ichi])
s = list(input())
k = int(input())

sum1 = 0
for i in s:
    if(int(i) == 1):
        sum1 += 1
    else:
        ans = int(i)
        break

if(sum1 >= k):
    print("1")
else:
    print(ans)
s = list(input())
k = int(input())
cur = 1
for c in s:
    if c != "1":
        print(c)
        break
    else:
        if cur == k:
            print(c)
            break
        cur += 1
S=input()
K=int(input())
for i in range(K):
  if S[i]!='1':
    print(S[i])
    exit(0)
print(S[K-1])
S = input().rstrip()
K = int(input())
for s in S[:K]:
    if s!="1":
        print(s)
        exit()
print(1)
x=input()
m=int(input())
x=list(x)

if len(x)<m:
	m=len(x)
t=1
for i in range(m):
	if x[i]!='1' and t==1:
		t=x[i]
t=int(t)
print(t)
s=input()
k=int(input())
for i in s[:k]:
    if i=='1':
        continue
    else:
        print(i)
        exit()
print(1)
s = input()
k = int(input())
if s[0] != "1":
    print(s[0])
elif s[:k].replace("1","")=="":
    print("1")
else:
    print(s.replace("1","")[0])
S = input()
K = int(input())

ones = 0
nzero = ""
for i in S:
    if i == "1":
        ones += 1
    else:
        nzero = i
        break

if K <= ones:
    print(1)
else:
    print(nzero)
S=input()
K=int(input())
tmp=100
for i in range(len(S)):
  if S[i]!='1':
    tmp=i
    break
if K<=tmp:
  ans=S[0]
else:
  ans=S[tmp]
print(ans)
s = input()
k = int(input())

if k > len(s):
    for i in s:
        if i != '1':
            print(i)
            exit()
else:
    for i in range(k):
        if s[i] != '1':
            print(s[i])
            exit()

print(1)
def main():
    s = input()
    k = int(input())
    ans = solve(s, k)
    print(ans)


def solve(s, k):
    for i in range(k):
        if s[i] != '1':
            return s[i]
    return '1'


if __name__ == '__main__':
    main()
s = input()
k = int(input())

for i in range(k):
    if s[i] != '1':
        print (s[i])
        exit ()
else:
    print ('1')
s = input()
k = int(input())

for i in range(len(s)):
    if s[i] != '1':
        print(s[i] if i+1 <= k else 1)
        exit()

print(1)
s = input()
k = int(input())
ok = True
for i in range(k):
    if s[i] != "1":
        print(s[i])
        ok = False
        exit()
if ok:
    print(1)
s = input()
k = int(input())
k = k-1
def not1(t):
    for i in range(len(t)):
        if t[i] != '1':
            return (i, t[i])
    return (-1, '1')
(j, t) = not1(s)
if j == -1:
    print('1')
    exit()
if k < j:
    print('1')
    exit()
if k >= j:
    print(t)
    exit()
S = input()
K = int(input())
ans = 1
if K == 1:
	print(S[0])
	exit()
else:
	for i in range(len(S)):
		if S[i] != "1" and i < K:
			ans = int(S[i])
			break
print(ans)
s = input()
k = int(input())

cnt = 0
for v in s:
  if v == "1": cnt += 1
  else: break
  if cnt == k: break
print(v)
s=input()
i=1
while 1:
    if i==len(s)+1:
        print(1);exit()
    if s[i-1]!="1":
        t=i 
        ans=int(s[i-1])
        break
    i+=1
# print(t)
if int(input())<t:
    print(1);exit()
print(ans)
S = input()
K = int(input())
count = 0
for t in S:
  if int(t) == 1:
    count += 1
  else:
    break
if K <= count:
  print(1)
else:
  print(int(S[count]))
import sys
s=input()
k=int(input())
for i in range(min(len(s),k)):
  if s[i]!="1":
    print(s[i])
    sys.exit()
print(1)
S = input()
K = int(input())

tmp_S = S[:K]
if tmp_S.count('1')==K:
    print(1)
    exit()
else:
    for i in range(len(S)):
        if S[i]!='1':
            print(S[i])
            exit()
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

S = input()
K = int(input())

for i in range(K):
	if S[i] == '1':
		continue
	else:
		print(S[i])
		sys.exit()

print(S[K-1])
S=input()
k=int(input())
cnt=0
for i in range(len(S)):
    if S[i]=="1":
        cnt+=1 
    else:
        temp=S[i]
        break 
if k<=cnt:
    print(1)
else:
    print(temp)
s = input()
n = int(input())
k = 0
for i in s:
    if i == "1":
        k += 1
    else:
        break
for i in s:
    if n <= k:
        print(i)
        exit()
    else:
        if i == "1":
            continue
        else:
            print(i)
            exit()
s = input()
k = int(input())
for i in s[:k]:
    if i!="1":
        print(i)
        break
else:print("1")
a=input()
b=int(input())
c=1
if a[0]!="1":
  print(a[0])
if a[0]=="1":
  for i in range(len(a)-1):
    if a[i]=="1" and a[i+1]=="1":
      c=c+1
    else:
      break
  if c>=b:
    print(1)
  else:
    print(a[c])
s = input()
k = int(input())

notone = 1
notonei = 101
for i, n in enumerate(s):
    if n != "1":
        notone = int(n)
        notonei = i
        break

if k <= notonei:
    print(1)
else:
    print(notone)
s=input()
k=int(input())
ans=-1
flag=True    
for i in range(min(len(s),k)):
    if s[i]!='1':
        flag=False
        ans=int(s[i])
        break
if flag:
    print(1)
else:
    print(ans)
def main():
    s = input()
    k = int(input())

    if s[0] != '1':
        print(s[0])
        exit()

    for i in range(1,len(s)):
        if s[i] != '1':
            break
    else:
        print(1)
        exit()

    if i >= k:
        print(1)
        exit()

    print(s[i])

if __name__ == '__main__':
    main()
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    S = input()
    K = int(input())

    if K >= 1e3:
        K = 105

    T = ''
    for i in range(len(S)):
        if S[i] == '1':
            T += '1'
        else:
            T += S[i] * K

        if S[i] != '1':
            break

    print(T[K - 1])


if __name__ == '__main__':
    main()
S = list(input())
K = int(input())

cnt1 = 0
for i in range(K):
    if S[i] == '1':
        cnt1 += 1
    else:
        break
if K <= cnt1:
    print(1)
else:
    print(S[cnt1])
#!/usr/bin/env python3
s = input()
k = int(input())
idx = 1
for i in range(len(s)):
    if idx <= k:
        if int(s[i]) == 1: idx += 1
        else:
            print(s[i])
            exit()
    else: break
print(1)