peterverebics/CodeNet_Python_118 huggingface dataset:
s = input()+"2"
k = int(input())

for i,j in enumerate(s):
    if j != "1":
        now = i
        break

if s == "1"*len(s):
    print(1)
else:
    if k < now:
        print(1)
    else:
        print(s[now])
import sys
s = input()
n = int(input())
for i in s:
	if i != '1':
		print(i)
		sys.exit()
S=input()
K=int(input())
for i in S:
    if i != '1':
        print(i)
        exit()
S = list(input())
for i in range(len(S)):
    S[i] = int(S[i])

K = int(input())

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

if K > 100:
    print(start)
elif K-1 >= loc:
    print(start)
else:
    print(1)
s = input()
k = int(input())
f = True
for si in s:
    if si != "1":
        print(si)
        f = False
        break
if f: print("1")
s = list(input())
k = int(input())
if len(s) <= 1:
    print(s[0])
else:
    if s[0] == '1':
        print(s[1])
    else:
        print(s[0])
s = str(input())
n = int(input())
for i in s:
    if i != "1":
        print(i)
        break
s = input()
for i in s:
    if i == "1":
        continue
    else:
        print(i)
        exit()
def main():
    S=input()
    K=int(input())
    for i in S:
        if i!='1':
            print(i)
            exit()
main()
S = input()
K = int(input())
ans = "1"
for i in range(len(S)):
  if S[i] != "1":
    ans = S[i]
    break
  if i > K:
    break
print(ans)
s = list(input())
k = int(input())

if set(s[:k+1]) == set([1]):
    print(1)
else:
    for x in s[:k+1]:
        if x != '1':
            print(x)
            break
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':
        continue
    else:
        ans=i
        break

print(ans)
s = list(map(int, input()))
k = int(input())
res = 1
for i in range(len(s)):
    if s[i] != 1:
        res = s[i]
        break
print(res)
s= input()
fn1 = "-1"
for i in range(len(s)):
    if s[i] != "1":
        fn1 = s[i]
        break
print("1" if fn1 == "-1" else fn1)
S = list(map(int,input()))
for i in range(len(S)):
  if S[i] != 1:
    print(S[i])
    break
import sys

input = sys.stdin.readline


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

    ans = 1
    for s in S:
        if s != "1":
            ans = int(s)
            break

    print(ans)


if __name__ == "__main__":
    main()
s = list(str(input()))
s = list(map(int, s))
k = int(input())

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

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

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

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

elif int(s[0])==1:
    num=1
    for i in range(1, len(s)):
        if int(s[i])!=1:
            num=int(s[i])
            break

    print(num)
elif int(s[0])!=1:
    print(int(s[0]))
S = input()
K = int(input())
count = 0
for i in range(len(S)):
    if S[i] == "1":
        count += 1
if count == len(S):
    print("1")
    exit()

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

s = input()
k = int(input())
TRI = 5 * 10 ** 15
if (len(s) == 1):
    print(s)
else:
    s1 = s[0]
    s2 = s[1]
    if (s1 == s2 == '1'):
        for i in range(len(s)):
            if (s[i] != '1'):
                print(s[i])
                sys.exit()
    else:
        if (s1 == '1'):
            print(s2)
        else:
            print(s1)
S,K=input(),int(input())
for i in list(S):
    if i!='1':print(i);break
A = input()
B = input()

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

k=int(input())

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

if cnt > k :
    print("1")
else:
    print(c)
import collections


def solve():

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

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


if __name__ == "__main__":
    solve()
S = input()
K = int(input())
length = 0
t = 5 * 10 ** 15
for s in S:
    s = int(s)
    if s == 1: length += 1
    else:
        length += s * t
    if K <= length:
        print(s)
        exit()
s= input()
fn1 = None
for i in range(len(s)):
    if s[i] != "1":
        fn1 = s[i]
        break
print("1" if fn1 is None else fn1)
S = list(str(input()))
K = int(input())

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

    if i == 1:
        num = pow(i, 5000000000000000)
    else:
        print(i)
        break
n = input()
k = int(input())

if n.count("1") == k:
  print(1)
  exit()

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

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

if S[0]=='1':
  if k==1:
    print(S[0])  
  elif k<(10**14+1):
    print(S[2])
  else:
    print(S[1])

elif S[0]=='2':
  if k<(10**14+1):
    print(S[0])
  else:
    if S[1]!=1:
      print(S[1])
    else:
      print(S[2])#1が続く場合は次の1以外の数字
      
else:
  print(S[0])
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 all_one == True:
        print("1")
    else:
        if idx >= K - 1:
            print("1")
        else:
            print(num)

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

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

if s[0] != '1':
    print(s[0])
else:
    if k == 1:
        print(s[0])
    else:
        print(s[1])
s = input()
n = int(input())

one_cnt = []
ans = 0
for i in range(len(s)):
    if s[i] == "1":
        one_cnt = i
    else:
        ans = s[i]
        break

print(ans if n - 1 != one_cnt else 1)
import sys
input = sys.stdin.readline
S = list(map(int, list(input())[: -1]))
K = int(input())
if S[0] == 1:
  if K == 1: print(1)
  else: print(S[1])
else: print(S[0])
def main():
    s = input()
    k = int(input())
    
    index = 0
    for i, ss in enumerate(s):
        if ss != '1':
            index = i
            break
    
    if k < index:
        print(1)
    else:
        print(s[index])

if __name__ == '__main__':
    main()
s = input()
k = int(input())    
for si in s:
    if si != '1':
        print(si)
        exit()
else:
    print(1)
# 1123311 = [[1,2],[2,1],[3,2],[1,2]]
S = input()
K = int(input())
Sd = [[int(S[0]), 1]]
n = 0

for i in range(len(S) - 1):
    if Sd[n][0] == S[i+1]:
        Sd[n][1] += 1
    else:
        Sd.append([int(S[i+1]), 1])
        n += 1

Sd = [[N, i] for N, i in Sd]

for n,i in Sd:
    if n==1:
        continue
    else:
        print(n)
        break
s = input()
k = int(input())

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

    for i, v in enumerate(s, 1):
        if v != '1':
            tmp = v
            break
    if i >= k or i == len(s):
        print(1)
    else:
        print(tmp)
s = input()
k = int(input())

flag  = 0

for i in s:
    if i == "1":
        continue
    else:
        print(i)
        flag = 1
        break

if flag == 0:
    print("1")
def resolve():
    s = input()
    k = int(input())
    cnt = -1
    for i in range(len(s)):
        if s[i] != '1':
            break
        cnt = i + 1
    if cnt > k:
        print(1)
    else:
        print(s[cnt] if len(s) > cnt > -1 else s[0])

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

output = ''

if len(S) >= K:
    for l in S:
        if l != '1':
            output = l
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break
    
if output:
    print(output)
else :
    print('1')
S = list(input())
for i in S:
    if i == "1":
        continue
    else:
        print(i)
        break
s=int(input())
s=list(str(s))
k=int(input())
i=0
while True:
  if i==len(s):
    print(1)
    break
  if s[i]!="1":
    print(s[i])
    break
  else:
    i=i+1
S = input()
K = int(input())
L = 0

for s in range(len(S)):
  if S[s]=="1":
    L+=1
  else:
    L+=int(S[s])*5000000000000000
    if L>K:
      print(S[s])
      exit()
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
    print(1)


if __name__ == "__main__":
    main()
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 = list(map(int, input()))
K = int(input())
#num = [pow(S[i], 10**12) for i in range(len(S))]
if len(S) == 1:
    print(S[0])
    exit()
if S[0] == 1:
    print(S[1])
else:
    print(S[0])
S = list(map(int,input()))
K = int(input())
for i in range(K):
  if S[i] != 1:
    print(S[i])
    break
a = input()
b = int(input())
cnt = b
for i in a:
  if cnt == 0:
    print("1")
    break
  else:
    if i =="1":
      cnt -= 1
    else:
      print(i)
      break
S = input()
K = int(input())

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

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

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

for i in S:
    if i != "1":
        print(i)
        quit()

print(1)
from itertools import groupby
n = list(input())
k = int(input())
if n == 1:
    print(1)
    exit()
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()
k = int(input())

for i in range(k):
    if s[i] != '1':
      print(s[i])
      break 
if i == k-1:
    print(1)
S=input();
K=input();
i = 0;
for i in range(len(S)) :
    if int(S[i]) > 1 :
        print(S[i]);
        break;
s = input()
k = int(input())
if k == 1: print(s[0])
elif s[0] == "1": print(s[1])
else: print(s[0])
S = input()
K = int(input())
mem = 1
for i in S:
  if i != "1": 
    print(i)
    break
  else: mem += 1 
  if mem == K: print(i)  
else: print("1")
s = list(str(input()))
k = int(input())

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

for i,a in enumerate(s):

    if i == k and i == 1:
        print(1)
        exit(0)
        
    elif a == 1:
        continue
    else:
        print(a)
        exit(0)
s = list(input())
k = int(input())
for i in s:
	if int(i) > 1:
		print(i)
		exit()
s = input()
k = int(input())

if len(s) == 1:
    print(s)
    exit()

if s[0] == '1':
    print(s[1])
else:
    print(s[0])
S,K=list(input()),int(input())
for i in S:
    if i!='1'or K==0:
        print(i)
        exit()
    K-=1
S = input()
if len(S) == 1:
  print(S)
elif 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":
    break
print(s[i])
S = input()
for c in S:
    if c != '1':
        print(c)
        break
else:
    print(1)
s=input()
k=int(input())
l=len(s)

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

ans = 1
for s in S[:K+1]:
    if s != "1": 
      ans = s
      break
      
print(ans)
s=input()
k=int(input())
ans=-1
for i in s:
    if i!='0' and i!='1':
        ans=int(i)
        break
print(ans) if ans!=-1 else print(s[k-1])
s = list(input())
s = list(map(int,s))
k = int(input())
for _ in s:
    if _ != 1:
        print(_)
        exit(0)
print(1)
import sys

s = list(map(str, input().rstrip()))
_ = int(input())

for x in s:
    if int(x) != 1:
        print(x)
        sys.exit()
else:
    print(1)
s = input()
rep = s.replace("1", "")
if len(rep) == 0:
    print("1")
else:
    print(rep[0])
s=[int(i) for i in list(input())]
k=int(input())
n=len(s)
if set(s)=={1}:
  print(1)
else:
  for i in range(n):
    if s[i]!=1:
      print(s[i])
      break
S = [int(i) for i in input()]
K = int(input())

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

if len(s) >= k and s[k-1] == '1':
    print(1)

else:
    for si in s:
        sii  = int(si)
        if sii != 1:
            print(sii)
            exit()
    else:
        print(1)
s=list(input())
k=int(input())
for i in s:
    ans=i
    if i!=2:
        break
print(ans)
S = input()
K = int(input())

if K == 1:
    print(S[0])
else:
    if all(s == "1" for s in S[:K]):
        print(1)
    else:
        print(S[1] if S[0] == "1" else S[0])
import sys

input = sys.stdin.readline

def main():
    ans = ''
    index = 0
    s = input()
    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())
index = 0

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

if (index == 0):
    print(1)
else:
    print(S[index])
S = input()
K = int(input())

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

i = 0
while i < len(s) - 1:
    if s[i] == '1':
        i += 1
    else:
        print(s[i])
        exit()
    if i == k -1:
        print(1)
        exit()
print(s[i])
def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    S = input()
    K = ii()
    if S[0] == '1':
        if K == 1:
            ans = S[0]
        else:
            ans = S[1]
    else:
        ans = S[0]

    print(ans)

if __name__ == '__main__':
    main()
s = list(str(input()))
s = list(map(int, s))
k = int(input())

if k == 1:
    print(s[0])
else:
    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, c in enumerate(s):
  if c != "1":
    print(c)
    break
  if i >= k:
    print(1)
    break
else:
  print(1)
s = list(input())
k = int(input())

if set(s[:k]) == set([1]):
    print(1)
else:
    for x in s[:k+1]:
        if x != '1':
            print(x)
            break
s = list(input())
k = int(input())
if s[0] == 1:
    print(s[1])
else:
    print(s[0])
s=input()
n=int(input())

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

cnt=0 #1の個数
i=0
while True:
    if s[i]!='1': break
    else:
        cnt+=1
        i+=1
        if i>len(s)-1: break
print(cnt)
        
print(1 if k<=cnt else s[cnt])
s = input()
k = int(input())
for si in s:
    if si != '1' or k == 0:
        print(si)
        break
    else:
        k -= 1
else:
    print(1)
s = input()
k = int(input())
 
if s[0] == "1":
  if k == 1:
    print(s[0])
  else:
    print(s[1])
else:
  print(s[0])
s = input()
k = int(input())

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

ans = '1'
for c in k:
    if c != '1':
        ans = c
        break
print(ans)
def main():
    s = list(input())
    k = input()
    n = len(s)
    for i in range(n):
        if s[i] != "1":
            ans = s[i]
            break
        if i == n-1:
            ans = s[0]
    print(ans)


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

if k != 1 and s[0] == "1":
    print(s[1])
else:
    print(s[0])
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()
  print(1)
  
else:
  for i in s:
    if i != '1' and i not in s[:k]:
      print(1)
      exit()
    elif i != '1' and i in s[:k]:
      print(i)
      exit()
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

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

    if S[0] == 1 and K <= 5000000000000:
        print(1)
        exit()

    T = S.replace('1', '')
    if T == '':
        print(1)
        exit()

    else:
        print(T[0])


if __name__ == '__main__':
    main()
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
S = input()
K = int(input())

for i in range(len(S)):
    if(S[i] == "1"):
        continue
    else:
        print(S[i])
        break
S = input()
K = int(input())
L = 0

for s in range(len(S)):
  if S[s]=="1":
    L+=1
  elif (L+int(S[s])*5000000000000000)>K:
    print(S[s])
    exit()
  else:
    L+=int(S[s])*5000000000000000
s = list(input())
k = int(input())
if k >= 2 and s[0] == 1:
    print(s[1])
if len(s) == 1:
    print(s[0])
else:
    print(s[0])
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()
    k = int(input())

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


if __name__ == '__main__':
    resolve()
S = input()
K = int(input())
ans = "1"
for i in S:
  if i != "1":
    ans = i
    break
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:
  print(a[c-1])
s=input()
k=int(input())
for i in range(len(s)):
    if s[i]=="1":
        k-=1
    else:
        k-=int(s[i])*(5*10**16)
    if k<=0:
        print(s[i])
        exit()
s=input()
len_s=len(s)
cnt=0
k=int(input())
for v in s:
    if v!='1':
        print(int(v))
        break
    else:
        cnt+=1
        if len_s==cnt:
            print(1)
            break
n = list(input())
k = int(input())
for i in range(min(len(n),k)):
    if n[i] != '1':
        print(n[i])
        exit()
S = input()
k = int(input())
for s in S:
    if s != '1':
        print(s)
        exit()
print(1)
s = int(input())
k = int(input())

ans = 1
for i in str(s):
    if i == '1':
        pass
    else:
        ans = i
        break
print(ans)
S = input()
K = int(input())
r = "1"
for i, s in enumerate(S):
    if s != "1":
        r = s
        break
print(r)
s=input()
for i in range(len(s)):
  if s[i]!="1":
    print(s[i])
    break
S = list(input())
K = int(input())
ans = 0
for i in range(len(S)):
    if S[i] !='1':
        ans = S[i]
        break
print(ans)
s = input()
k = int(input())

for i in range(k):
    if s[i] != '1':
      print(s[i])
      break 
if i == k:
    print(1)
import sys

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

for i in range(min(4, len(k))):
    if k[i]!="1":
        print(k[i])
        sys.exit()
print(1)
S = input()
K = int(input())

for i in range(len(S)) :
    if S[i] == "1" :
        continue
    else :
        print(S[i])
        exit()
S=input()
K=int(input())
mark=0
for i in range(len(S)):
    if(S[i]!='1'):
        mark=i
        break
if(K-1>mark):
    print(S[mark])
else:
    print(1)
S=input()
K=int(input())
for s in S:
    if s!="1":
        print(s)
        break
else:
    print(1)
s = list(input())
K = int(input())

for ss in s:
	if ss != "1":
		print(ss)
		break

if set(s) == {"1"}:
	print("1")
S = input()
K = int(input())

if S[0] != 1 and len(S) != 1:
  print(S[0])
elif S[0] != 1 and len(S) == 1:
  print(S[0])
else:
  print(1)
s=input()
k=int(input())
cnt = 0
for i in s:
    if i == '1':
        cnt +=1
if cnt >=k:
    print(1)
    exit()
for i in s:
    if i != '1':
        print(i)
        exit()
s = str(input())
k = int(input())


ind = 0
num = 1


for i in range(len(s)):
    ind = i+1
    if s[i] != 1:
        num = int(s[i])
        break
        
if k>= ind:
    ans = num
else:
    ans = 1
    
print(ans)
s = input()
k = int(input())

all1 = True
if k <= len(s):
    for i in range(k-1):
        if s[i] != '1':
            all1 = False
    if all1:
        print(s[k-1])
        exit()
if s[0] == '1':
    if len(s) == 1:
        print(s[0])
    else:
        print(s[1])
else:
    print(s[0])
s = str(input())
k = int(input())


for i in range(k):
    if s[i] == "1" :
        continue
    print(s[i])
    exit()
s = input()
k = int(input())
lengh = 0
ans = '1'
for i in list(s):
    if i != '1':
        ans = i
        break
if k <= len(s) and ['1']*k == s[:k]: ans = s[k-1]
print(ans)
S = input()
K = int(input())

for s in S[:K+1]:
    if s != "1": 
      print(s)
      break
else:
  print(1)
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    S=readline().strip()
    K=int(readline())

    if len(S)==1:
        print(S[0])
    elif K==1:
        print(S[0])
    else:
        if S[0]!="1":
            print(S[0])
        else:
            print(S[1])

if __name__=="__main__":
    main()
s=input()
for i in list(s):
    if i!="1":print(i);exit()
s=str(input())
k=int(input())
ans="1"
for i in range(len(s)):
  if s[i]!="1":
    ans=s[i]
    break

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

if k == 1:
    print(s[0])
else:
    for i in s:
        if i != '1':
            print(i)
            quit()
from collections import defaultdict
def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

s = readChar()
k = readInt()
if k==1:
  print(s[0])
  exit()
for i in range(len(s)):
  if s[i]!=str(1):
    print(s[i])
    exit()
s = input()
for e in s:
  if e != "1":
    print(e)
    break
else:
  print("1")
s = input()
k = int(input())
l = len(s)

for i in range(l):
  if s[i] != "1":
    print(s[i])
    exit()
  else:
    k -= 1
    if k == 0:
      print(1)
s_list = list(input())
k = int(input())
for s in s_list:
    if s != "1":
        print(s)
        exit()
print(1)
k = int(input())
s = str(input())




num = 1


for i in range(len(s)):
    ind = i+1
    if s[i] != '1':
        num = int(s[i])
        break
        
if k>= ind:
    ans = num
else:
    ans = 1
    
print(ans)
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]

print(t)
def main():
    S = input()
    k = int(input())

    for i,s in enumerate(S):
        s = int(s)
        if s != 1:
            print(s)
            return
        if i == k:
            print(1)
            return 
    print(1)


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

k = int(input())
if k == 1:
    print(n[0])
else:
    if len(n) == 1:
        print(n)
    else:
        if n[0] == "1":
            print(n[1])
        else:
            print(n[0])
S = str(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())

first_not_1=-1
for i,s in enumerate(S):
    if s=="1":
        continue
    else:
        first_not_1=i
        break

if K<first_not_1:
    print(1)
else:
    print(S[first_not_1])