peterverebics/CodeNet_Python_118 huggingface dataset:
s=list(map(int,tuple(input())))
k=int(input())
i=0
if 1 in s:
  i=s.index(1)
  if i+1>=k:
      print(1)
  else:
      print(s[i+1])
else:
  print(s[0])
x=input()
x=list(x)
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)
def main(s, k):
    for i, si in enumerate(s):
        if i == k - 1:
            print(1)
            return

        if si != "1":
            print(si)
            return
    
    print(1)

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

    main(s, k)
S=input()
K=int(input())
for s in S:
    if s!=1:
        print(s)
        break
s = list(map(int, input()))
k = int(input())
res = int()
n = int()
for i in range(len(s)):
    if s[i] != 1:
        res = s[i]
        n = i + 1
        break
if k >= n:
    print(res)
else:
    print(1)
s = int(input())
k = int(input())

for i in str(s):
    if i == '1':
        pass
    else:
        print(i)
import sys

input = sys.stdin.readline

def main():
    ans = ''
    index = 0
    s = input().rstrip('\n')
    k = int(input())
    for i in range(len(s)):
        if s[i] != '1':
            ans = s[i]
            index = i
            break
    if ans == '' or k < index:
        ans = '1'
    print(ans)

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

k=int(input())

cnt=0
c=""
for i in s:
    cnt+=1
    if i != "1":
        c=i
        break

if cnt > k :
    print("1")
else:
    print(c)
s = list(input())
k = int(input())
for i in range(len(s)):
    if s[i] == '1':
        if k-1 == 1:
            print(s[i])
            exit()
    else:
        print(s[i])
        exit()
s_list = list(input())
for s in s_list:
    if s != "1":
        print(s)
        exit()
else:
    print(1)
s = list(input())
k = int(input())

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

if k > 100:
  for i in s:
    if i != '1':
      print(1)
      exit()
else:
  for i in s:
    if i != '1' and i not in s[:k+1]:
      print(1)
      exit()
    elif i != '1' and i in s[:k+1]:
      print(i)
      exit()
s = input()
k = int(input())

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

for i in range(len(s)):
    if s[i] == "1" and i == k-1:
        print(1)
    if s[i] != "1" and i > k:
        print(s[i])
        exit()
    if i == len(s):
        print(1)
from itertools import groupby
n = list(input())
k = int(input())
li = []
for key,v in groupby(n):
    li.append(list(v))

if li[0][0] == "1":
    if len(li[0])>= k:
        print(1)

for i in range(len(n)):
    if n[i] != "1":
        print(n[i])
        break
s = input().rstrip()
if len(s) == s.count('1'):
    print(1)
else:
    print(s.replace('1', '')[0])
s=input()
k=int(input())

if k==1:
    print(s[0])
elif s[0]=="1":
    print(s[1])
else:
    print(s[0])
s = list(input())
k = int(input())

if k == 1:
    print(s[0])
else:
    if s[0] == "1":
        print(s[1])
    else:
        print(s[0])
S = input()
K = int(input())

num = '1'
for s in S:
    if s != '1':
        num = s
        break

print(num)
s = list(input())
k = int(input())

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

print("1")
import sys
import math

s=input()
k = int(input())
cnt=0
for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        sys.exit()
if (cnt == 0):
    print(1)
S=list(input())
K=int(input())
#print(S)
i=0;p=0
while i!=len(S):
  if S[i]!="1":
    print(S[i])
    p=1
    break
  i=i+1
if p==0:
  print("1")
s = input()
k = int(input())

if s[0] == 1:
  print(s[1])
else:
  print(s[0])
S = input()
K = int(input())
if len(S) == 1 or K == 1:
  print(S[0])
elif S[0] == '1':
  print(S[1])
else:
  print(S[0])
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    S=list(map(int,list(input())))
    K=int(input())
    for n in S:
        if n!=1:
            print(n)
            exit()

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

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

for i in range(len(str(s))):
    if str(s)[i]!='1':
        print(str(s)[i])
        exit()
print(1)
s = input()
for c in s:
  if c != '1':
    print(c)
    break
else:
  print(1)
S = input()
K = int(input())
for i in range(len(S)):
  if(S[i] != '1' and S[i] != '0'):
    print(int(S[i]))
    exit()
print(1)
A = str(input())
B = int(input())
count = 0

for i in range(len(A)):
    if A[i] == "1":
        count += 1
    else:
        if count == B:
            print(1)
            break
        else:
            print(A[i])
            break
S = input()
K = int(input())

# 5 * 10^15
cnt = 0

for i in range(len(S)):
    if int(S[i]) == 1:
        cnt += 1
    else:
        if cnt >= K:
            print(1)
        else:
            print(int(S[i]))
        break
S = [int(i) for i in input()]
K = int(input())

if sum(S)==len(S):
    print(1)
else:
    for i in range(len(S)):
        if S[i]!=1:
            print(S[i])
            break
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

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

    if K == 1 and S[0] == '1':
        print(1)
    elif S[0] == '1':
        print(S[1])
    else:
        print(S[0])

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

for i in S:
  if i!="1":
    print(i)
    exit()
import sys
input = sys.stdin.readline

S = list(input().rstrip('\n'))
K = int(input())

n = 1
for i in range(len(S)):
    if S[i] != '1':
        if i+1 < K:
            n = int(S[i])
        break
print(n)
s = str(input())
k = int(input())


for i in range(len(s)):
    if s[i] == "1":
        continue
    print(s[i])
    exit()
s = input()
k = int(input())
cnt = 0
for i in s:
    if i == 1:
        cnt += 1
        if cnt == 4:
            print(1)
    else:
        print(i)
        break
import sys

S = sys.stdin.readline().strip()
K = int(sys.stdin.readline())

for s_i in S:
    if s_i == "1":
        K -= 1
    else:
        K -= 5000000000000000 * int(s_i)
    if K <= 0:
        break
print(s_i)
s = input()
k = int(input())

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

k = int(input())

tyou = 5000000000000000

if k == 1:
    print(s[0])
else:
    for i in range(len(s)):
        if int(s[i]) == 1:
            pass
        else:
            print(s[i])
            exit()
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = readline().decode().strip()
K = int(readline())
ans = 1
for i in range(K):
    if i != '1':
        ans = i
        break

print(ans)
def solve():
    for i in s:
        if i != 1:
            print(i)
            exit()
    print(1)

if __name__=="__main__":
    S = input()
    K = int(input())
#    d = 5*10**15
    s = [int(c) for c in S]
#    print(s)
    solve()
s=input()
k=int(input())

if k==1:
    print(int(s[0]))

elif int(s[0])==1:

    if len(s)<k:
        num=1
        for i in range(1, len(s)):
            if int(s[i])!=1:
                num=int(s[i])
                break
        print(num)

    else:
        if s[:k]=="1"*k:
            print(1)

elif int(s[0])!=1:
    print(int(s[0]))
s = input()
k = input()
 
flag = True
 
for i in range(len(k)):
  if s[i] != 1:
    print(s[i])
    flag = False
    break
    
if flag:
  print("1")
s = input()
k = int(input())
l = len(s)
pos = 0

for i in range(l):
    if s[i] != "1":
        pos = i
        break

print(s[pos])
s=input()
k=int(input())
sl=list(s)
for i in range(len(sl)):
    if s[i]!='1':
        print(s[i])
        exit()
print(1)
s = list(str(input()))
s = list(map(int, s))
k = int(input())

flag = True
for i in range(len(s)):
    if s[i] == 1:
        pass
    else:
        print(s[i])
        flag = False
        break

if flag:
    print(1)
S = input()
K = int(input())

for i, s in enumerate(S, 1):
    if s != "1":
        print(s)
        break
    else:
        if i == K:
            print("1")
s = input()
k = int(input())

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

if S.count('1') == len(S):
    print(1)
    exit(0)
for s in S:
    if s != '1':
        print(s)
        exit(0)
s = list(input())
k = int(input())
number = 0
count = 0
for i in range(len(s)):
    if s[i] == "1":
        count += 1
        if count == k - 1:
            number = 1
    elif s[i] != "1" and number == 0:
        number = s[i]
print(number)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    S = readline().strip().decode()
    K = int(readline())
    if (S[0] == '1'):
        if K == 1:
            print('1')
            return
        else:
            print(S[1])
    else:
        print(S[0])
    
    
if __name__ == '__main__':
    main()
S = input()
K = int(input())
if list(set(S)) == ["1"]:
    print(1)
elif S[0] == "1" and K > 1:
    ind = 1
    while S[ind] == "1":
        ind += 1
    print(S[ind])
else:
    print(S[0])
s = list(input())
k = int(input())
cnt = 0
if k >= len(s):
    x = len(s)
else:
    x = k

for i in range(x):
    if s[i] == 1:
        cnt += 1
if cnt == len(s):
    print(1)
else:
    for j in s:
        if int(j) > 1:
            print(int(j))
            break
S = input()
K = int(input())

if len(S) == 1:
    print(S[0])
elif K == 1:
    print(S[0])
elif S[0] == '1':
    print(S[1])
else:
    print(S[0])
s = input()
k = int(input())
if k == 1:
  print(s[0])
else:
  if s[0] == '1':
    for i in range(len(s)):
      if s[i] != '1':
        print(s[i])
        exit()
    print(s[1])
  else:
    print(s[0])
S = list(input())
K = int(input())

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

ans = ""
if ref == 0:
    ans = S[0]
else:
    if ref >= K:
        ans = "1"
    else:
        ans = S[ref-1]

print(ans)
a=input()
b=int(input())
c=0
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:
    if c>=len(a)-1:
      print(1)
    else:
      print(a[c+1])
def main():
    S = list(map(int, list(input().rstrip())))
    K = int(input())
    if sum(S[:K]) == K:
        print(1)
    else:
        for s in S:
            if s != 1:
                print(s)
                exit()


if __name__ == '__main__':
    main()
def resolve():
	s = list(input())
	k = int(input()) - 1
	for i in range(len(s)):
		if int(s[i]) == 1:
			continue
		else:
			for j in range(i, len(s)):
				s[j] = s[i]
	if k < len(s):
		print(s[k-1])
		return
	print(s[-1])
resolve()
S = input()
n = int(input())
ans = 1
for s in S:
    if s != "1":
        ans = s
        break
print(ans)
s = input()
k = int(input())
#5,000,000,000,000,000
count = 5000000000000000

lis = [int(s[i]) for i in range(len(s))]
for l in lis:
    if l == 1:
        if k == 1:
            print(1)
            exit()
        else:
            k -= 1
            continue
    else:
        if k - l*count > 0:
            k -= l*count
            continue
        else:
            print(l)
            exit()
s = list(input())
k = int(input())
coun= 0

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

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

print("1")
def main():
    S = input()
    K = int(input())
    idx = 0
    num = ""

    all_one = True
    for i in range(len(S)):
        idx = i
        num = S[i]

        if S[i] != "1":
            all_one = False
            break

    if idx >= K - 1 and all_one == True:
        print("1")
    else:
        print(num)

if __name__ == "__main__":
    main()
s = input()
k = input()
for _ in s:
    if _ != '1':
        print(_)
        exit()
if __name__ == '__main__':

	S = input()
	n = int(input())

	for x in S:
		if x != "1":
			print(x)
			break
	else:
		print("1")
s = input()
k = int(input())
if k == 1:
  print(s[0])
else:
  if s[0] == '1':
    print(s[1])
  else:
    print(s[0])
S = list(input())
K = int(input())
for i in range(len(S)):
    if S[i] != 1:
        print(S[i])
        exit()
print(1)
s=input()
i=1
while 1:
    if s[i-1]!=1:
        t=i 
        ans=s[i-1]
        break
    i+=1
if int(input())<=i:
    print(1);exit()
print(ans)
def main(s, k):
    for i, si in enumerate(s):
        if i == k - 1:
            print(1)
            return

        if si != "1":
            print(si)
            return


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

    main(s, k)
S = input()
K = int(input())
if len(S) >= K and S[K-1] == "1":
    print(1)
else:
    print([c for c in S if c != "1"][0])
import sys
import math

s=input()
k = int(input())
cnt=0
for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        sys.exit()
    cnt+=1
if (cnt == 0):
    print(1)
import sys

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


s=list(s)

for i in range(len(s)):
        if s[i]!='1':
                print(s[i])
                sys.exit()
S=input()
K=int(input())
for s in S:
    if s!=1:
        print(s)
        break
else:
    print(1)
s=input()
k=int(input())
cnt = 0
for i in s:
    if i =='1':
        cnt +=1
    else:
        print(i)
        exit()
if cnt == len(s):
    print(1)
S = input()
K = int(input())
if K == 1: print(S[0])
else:  
  for i in S:
    if i != "1": 
      print(i)
      break
  else: print("1")
s = input()
k = int(input())
cnt = 0
ans = 1
for i in s:
    if i == 1:
        cnt += 1
    else:
        ans = i
        break

if k <= cnt:
    print(1)
else:
    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)
import sys
import math

s=input()
k = int(input())
cnt = False
ans=0
for i in range(len(s)):
    if s[i] != '1':
        ans = s[i]
        cnt = True
        break
    cnt+=1
if (not cnt):
    print(1)
else:
    print(ans)
s = input()
k = int(input())

l = list(filter(lambda c: c != '1', list(s)))
print(1 if len(l) == 0 else l[0])
# C - To Infinity

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

if S[0] == '1' and len(S) > 1:
    print(S[1])
else:
    print(S[0])
s = input()
k = int(input())
flag = False
for i in range(len(s)):
    if s[i] != '1':
        id = s[i]
        flag = True
        break
if flag:
    print(id)
else:
    print(1)
s=input()
k=int(input())
cnt=0
if s[0]!="1":
	print(int(s[0]))
if s[0]=="1":
	for i in s:
		cnt+=1
		if i!="1":
			if cnt<=k:
				print(int(i))
				exit()
			if cnt>k:
				print(1)
				exit()
a=input()
k=0
while a[k]=='1'and len(a)-1>k:
  k+=1
b=int(input())
if b<k or a=='1'*len(a):print(1)
else:print(a[k])
import sys
s = str(input())
n = int(input())
i = 0
while True:
    if 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())

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

answer = S[i]
print(answer)
s = input()
k = int(input())

for v in range(len(s)):
    if (s[v] == "2" or s[v] == "3" or s[v] == "4"):
        print(s[v])
        break
    if v+1 == k:
        print(s[v])
        break
    if v+1 == len(s):
        print(s[0])
        break
def main():
    S = input()
    k = int(input())

    for s in S:
        s = int(s)
        if s != 1:
            print(s)
            return
    print(1)


if __name__ == '__main__':
    main()
s = input()
k = int(input())
m = 5*10**15

if len(s)==1:
    print(s[0])
    quit()

for c in s:
    if c != '1':
        print(c)
        quit()
import sys
s = input()
n = int(input())
if n == 1:
	print(s[0])
	sys.exit()
for i in s:
	if i != '1':
		print(i)
		sys.exit()
print(1)
S=input()
K=int(input())
S=list(S)

for j in range(len(S)):
    if S[j]=='1':
        if j==K-1:
            ans=1
    else:
        x=[i for i in S if i!="1"]
        ans=x[0]

print(ans)
n = input()
m = int(input())
cnt = 0
for i in range(len(n)):
    if n[i] == "1" :
        cnt +=1
    else:
        if  cnt >m:
            print(1)
        else:
            break
for i in range(len(n)):
    if n[i] != "1":
        print(n[i])
        break
s = input()
k = int(input())
ok = True
for i in range(len(s)):
    if s[i] != '1':
        ok = False

if ok:
    print('1')
    exit()

for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        exit()
S = list(input())
K = int(input())

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

elif S[0] == 1:
    print(S[1])

else:
    print(S[0])
s = input()
k = int(input())

for i, v in enumerate(s):
    if (v == "2" or v == "3" or v == "4") and k >= i+1:
        print(v)
        break
    if i+1 == k and v == "1":
        print(1)
        break
s=input()
k=int(input())
if s[0]==1:
  print(s[1])
else:
  print(s[0])
import sys
def input(): return sys.stdin.readline().strip()

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

    for c in S:
        if c != '1':
            print(int(c))
            return



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

for s in S:
    if s!='1':
        print(int(s))
        break
s = list(input())
k = int(input())


for i in range(k):

    if int(s[i]) != 1:
        print(i)
        exit()
print(1)
#!/usr/bin/env python3

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

if s[0] == "1":
    if k == 1:
        print(1)
    else:
        print(s[1])
else:
    print(s[0])
S = input()
K = int(input())

ans = 1
for i in S:
	print(i,K)
	if i != '1':
		ans = i
		break
	if K==1:
		ans = i
		break
	K-=1
print(ans)
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = readline().decode().strip()
K = int(readline())
if len(N) == 1:
    ans = N[0]
else:
    if N[0] == '1':
        ans = N[1] if K < int(N[1]) * 5000 * 10 ** 12 else N[2]
    else:
        ans = N[0] if K < int(N[0]) * 5000 * 10 ** 12 else N[1]
print(ans)
S = input()
K = int(input())
for i in range(K):
    if S[i] != 1:
        print(S[i])
        exit()
print(1)
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    s = input().rstrip()
    k = int(input())
    
    for i in s:
        if int(i) !=1:
            print(i)
            exit()
        else:
            continue
    print(1)

if __name__=="__main__":
    main()
S=str(input())
K=int(input())
L=[1]*len(S)
count=0
#うしたぷにきあ君笑
for i in range(len(S)):
  if S[i]!='1' or K==1:
    print(int(S[i]))
    exit()
s = input()
k = int(input())
ans = 1
for i in range(k):
    if i!= '1':
        ans = i
        break
print(ans)
S = input()
K = int(input())

ans = S[0]

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

if s[0] == '1':
    if len(s) == 1:
        print(s[0])
    else:
        print(s[1])
else:
    print(s[0])
import sys
s = str(input())
n = int(input())
i = 0
while True:
    if s[i] == 1:
        i +=1
    else:
        print(s[i])
        sys.exit()
# AtCoder Beginner Contest 106
# C - To Infinity

# 5000000000000000

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

whileone=-1
ans=-1
for i in range (len(S)):
    if S[i]=="1":
        whileone=i+1
    else:
        ans=S[i]
        break

if whileone>0 and whileone>K:
    print(1)
else:
    print(ans)
s=list(map(int,list(input())))
k=int(input())
if s[0]!=1:
  print(s[0])
elif k>1:
  print(s[1])
else:
  print(1)
# coding: utf-8

# https://atcoder.jp/contests/abc106


def main():
    S = list(map(int, input()))
    K = int(input())

    head = 0
    for i in range(len(S)):
        if S[i] > 1:
            head = i
            break
    
    if K == 1:
        return S[0]
    
    return S[head]


print(main())
S = int(input())
K = int(input())
ans = 0
if int(str(S)[0]) == 1 and K == 1:
    ans = 1
elif int(str(S)[0]) != 1:
    ans = int(str(S)[0])
else:
    ans = int(str(S)[1])
print(ans)
s = input()
k = int(input())
for i in range(len(s)):
  if s[i] != 1:
    print(s[i])
    exit()
S = input()
K = int(input())
index = 0

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

if (index == 0):
    print('1')
else:
    print(S[index])
A = input()
B = input()

for i in range(len(A)):
    if A[i] != "1":
        print(A[i])
        break
import sys

s, k = sys.stdin.read().split()
k = int(k)

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

if __name__ ==  '__main__':
    main()
import math

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

logk=math.log10(k)

ss=[]
for i in range(len(s)):
    if s[i]!="1":
        ss.append(int(s[i]))
    
n=5000*10000**3

if len(ss)==0:
    print(1)
else:
    logketa=n*math.log10(ss[0])
    if logketa>logk:
        print(ss[0])
    else:
        print(ss[1])
# AL006 C

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

if s[0] == "1":
    if k == 1:
        print("1")
    else:
        print(s[1])
else:
    print(s[0])
s = input()
k = int(input())

for elem in s:
  if int(elem) == 1:
    if k == 1:
      print(elem)
      break
    else:
      pass
  else:
    print(elem)
    break
S = input()
K = int(input())

not_1_idx = -1
not_1_num = -1
for i, c in enumerate(S):
    if c != "1":
        not_1_idx = i
        not_1_num = c
        break
if not_1_idx >= 0:
    print(1) if K <= not_1_idx + 1 else print(not_1_num)
else:
    print(not_1_num)
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = readline().decode().strip()
K = int(readline())
cnt = 0
ans = 0
for i in N:
    if i == '1':
        cnt += 1
        continue
    else:
        if int(i) * 5000 * 10 ** 12 + cnt >= K:
            ans = i
            break
        else:
            ans = N[N.find(i) + 1]
            break

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

for i in range(k):
    if s[i] != '1':
      print(s[i])
      break 
print(1)
s = input()
k = int(input())
n = 5000 * 10**12

for c in s:
    if c != '1':
        print(c)
        break
S = input()
K = int(input())
for i in range(len(S)):
  if(S[i] != '1' and S[i] != '0'):
    print(int(S[i]))
    exit()
s = list(input())
s = [int(l) for l in s]
k = int(input())

if s[0] > 1:
  print(s[0])
elif sum(s[0:k]) == k:
  print(1)
else:
  i = 0
  while s[i] == 1:
    i += 1
    if s[i] != 1:
      print(s[i])
      break
s = list(str(input()))
k = int(input())

s = [int(i) for i in s]

for i in s:
    if i == 1:
        continue
    else:
        print(i)
        exit(0)
S = input()
K = int(input())
index = 0

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

if (index == 0):
    print(1)
else:
    print(int(S[index]))
def resolve():
    S = input()
    for i in range(len(S)):
        if S[i] == "1":
            continue
        else:
            print(S[i])
            exit()
    print("1")
resolve()
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

print(ans)
import sys
S = input()
K = int(input())
if len(S) == 1:
  print(S)
  sys.exit(0)
if K == 1:
  print(S[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 = str(input())
K = int(input())

ans = 1
index = 0
for j in range(len(S)):
    if S[j] != '1':
        ans = int(S[j])
        index = j
        break

if ans == 1:
    print(ans)
elif index >= K-1:
    print(1)
else:
    print(ans)
s = input()
k = int(input())

# sが1文字目から最後の文字 or k番目の文字までが1なら1
for i in range(len(s)):
    if s[i] != '1':
        print (s[i])
        exit ()
    if k < i:
        print (1)
        exit ()
else:
    print (1)
    exit ()
S = [int(i) for i in input()]
K = int(input())

ans = 1
for i in S:
    if i!=1:
        ans=i
        break
print(i)