peterverebics/CodeNet_Python_118 huggingface dataset:
s = str(input())
k = int(input())
count = 0
for i in s:
    if i == "1":
        count += 1
        if count == len(s):
            print(1)
            break
        else:
            pass
    else:
        if k <= count:
            print(1)
            break
        else:
            print(i)
            break
s = list(input())

k = int(input())

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

if p==-1:
  print(1)
else:
  if k<p+1:
    print(1)
  else:
    print(s[p])
s = int(input())
k = int(input())

for i in str(s):
    if i == '1':
        if k == 1:
            print(1)
            break
        else:
            k -= 1
    else:
        print(i)
        break
S = input()
K = int(input())

for i in range(len(S)):
    if(S[i] == "1"):
        if(i == K-1):
            print(S[i])
            break
        continue
    else:
        print(S[i])
        break
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 01:17:00 2020

@author: liang
"""

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

#count = 0
for i in range(len(S)):
    if S[i] != '1':
        break
#print("i",i)

if K < i + 1:
    print(1)
    #print("A")
else:
    print(S[i])
    #print("B")
s = input()
k = int(input())
ans = "1"
for i in range(min(k, len(s))):
    if s[i] != "1":
        ans = s[i]
        break
print(ans)
s = list(input())
k = int(input())
for i in range(len(s)):
    if s[i] == "1":
        if i == k - 1:
            print(1)
            exit()
    else:
        print(s[i])
        exit()
import sys

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

for s_i in S:
    if s_i == "1":
        K -= 1
    else:
        break
    if K <= 0:
        break
print(s_i)
S = list(input())
K = int(input())
ans = 1

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

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

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

print(1)
S = input()
k = int(input())

days = 5*10*15

for s in S:
    si = int(s)
    if si == 1:
        k -= 1
    else:
        k -= si**days

    if k <= 0:
        print(si)
        break
s=input()
k=int(input())
sl=list(s)
for i in range(k):
    if s[i]!='1':
        print(s[i])
        exit()
print(1)
import sys
S = str(input())
K = int(input())

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

count = 0
l = 0
for i in range(len(S)):
    if S[i] == '1':
        count += 1
    else:
        break
#print(count)
    
if count < K:
    print(S[count])
else:
    print(1)
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=list(input())
k=int(input())
cnt=0
ans=0
flag=0
for i in s:
    if i =="1":
        cnt+=1
        continue
    else:
        if cnt<k:
            print(i)
        else:
            print("1")
        flag+=1
        break
if flag==0:
    print("1")
S = input()
K = int(input())

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

nth = i + 1
if are_all_one or K < nth:
    print(1)
    exit()

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

for i in range(len(s)):
    if int(s[i])==1:
        k-=1
        if k==0:
            print(s[i]);exit()
    else:
        print(s[i]);exit()
import sys

sys.setrecursionlimit(10 ** 6)


def input(): return sys.stdin.readline().rstrip()


S = input()
K = int(input())
if all(c == '1' for c in S[:K]):
    print(1)
else:
    print(list(c for c in S if c != '1')[0])
if __name__ == '__main__':

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

	flg = False
	for x in range(n):
		if S[x] != "1":
			print(S[x])
			flg = True
			break
	if flg == False:
		print("1")
S=input()
K=int(input())

count=0

for s in S:
    if int(s)==1:
        count+=1
        if count>=K:
            print(s)
            break
    else:
        print(s)
        break
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    S = INT()
    K = INT()

    for i, s in enumerate(str(S)):
        if int(s) != 1:
            if i >= K: print(1)
            else: print(s)
            break
    else:
        print(1)


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

m = re.match(r'\A(1*)([1-9]*)\Z', input())
print('1' if len(m.group(1)) >= int(input()) else m.group(2)[0])
s = input()
k = int(input())
l = 0
ans = 0
for i in range(len(s)):
  if s[i] == '1':
    l += 1
    if k == l:
      ans = 1
      break
  else:
    ans = int(s[i])
    break
print(ans)
s=input()
n=int(input())
l=[]
for x in s:
    l.append(x)
    if x!="1":break
print(l[min(len(l)-1,n-1)])
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())
if s[0]!="1":
    print(s[0])
else:
    cnt=0
    for i in range(len(s)):
        if s[i]=="1":
            cnt+=1
        else:
            break
    if cnt>=k:
        print(1)
    else:
        print(s[cnt])
s = input()
n = len(s)
k = int(input())
ans = None
for i in range(k):
    if i == n:
        break

    if s[i] != '1':
        ans = int(s[i])
        break
    else:
        continue
if ans:
    print(ans)
else:
    print(1)
S = input()
K = int(input())

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


    
if k>=num:
  print(s[num-1])
else:
  print(1)
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
n = len(s)
k = I()
for i in range(n):
    if s[i] != '1':
        break
else:
    print(1)
    quit()
if k <= i:
    print(1)
else:
    print(s[i])
# coding = SJIS

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

ans = 1

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

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

if all(s[i]=="1" for i in range(min(len(s),k))):
    print(1)
else:
    while s[0]=="1":
        s = s[1:]
    print(s[0])
S=input()
K=int(input())
if all(S[i]=="1" for i in range(min(K,len(S)))):
    print(1)
else:
    for i in range(min(K,len(S))):
        if S[i]!="1":
            print(int(S[i]))
            break
def main():
    s = list(input())
    k = int(input())
    if max(s[:k]) == '1':
        print(1)
        return 0
    for i in s:
        if i > '1':
            print(i)
            return 0

if __name__ == '__main__':
    main()
S=input()
K=int(input())
a=[]
x=0
for i in range(2,10):
    x=S.find(str(i))
    if x!=-1:
        a.append(x)
    else:
        a.append(K)
m=min(a)
if m>K-1:
    print(1)
else:
    print(a.index(m)+2)
s = input()
k = int(input())
front1 = 0
if s == "1":
  print(1)
  exit()
for i in range(len(s)):
  if s[i] == "1":
    front1 += 1
  else:
    break
print(s[min(k-1, front1)])
S = input()
K = int(input())
for s in S[:K]:
    if s != "1":
        print(s)
        break
else:
    print(S[K-1])
def myAnswer(S:list,K:int) -> int:
   if(K == 1): return S[0]
   ans = ""
   for n,s in enumerate(S):
      if(s != "1"):
         ans = s
         break
      elif(s == "1" and n == K -1 ):
         ans = "1"
         break
   return ans

def modelAnswer():
   tmp=1
def main():
   S = list(input())
   K = int(input())
   print(myAnswer(S[:],K))

if __name__ == '__main__':
   main()
s = input()
k = int(input())
for si in s:
    if si != '1':
        print(si)
        break
    else:
        k -= 1
        if k == 0:
            print(1)
            break
S = input()
K = int(input())

for i,s in enumerate(S):
  if s != "1" and i < K: 
    print(s)
    exit()
print(1)
S = list(input())
K = int(input())

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

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

ans = 1
for i in range(len(S)):
    if int(S[i]) > 1 and i < K:
        ans = int(S[i])
        break
        
print(ans)
s=input()
k=int(input())
ans=1
for i in range(k):
  if s[i]!='1':
    ans=int(s[i])
    print(ans)
    exit()
print(1)
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

S = LI2()
K = I()

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

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

for i in range(min(len(s),k)):
    if s[i] != '1':
        print(s[i])
        quit()
 
print('1')
S = input()
K = int(input())
OK = True
for i in range(min(K, 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()
import sys
A = str(input())
B = int(input())
count = 0

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

i = 0
while i < K - 1 and S[i] == '1':
    i += 1
print(S[i])
S = input()
K = int(input())
ans = '1'
for i in range(len(S)):
  if S[i]!='1':
    if i<K:
      ans = S[i]
      break
print(ans)
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

cnt_1 = 0
for s in S:
    if s=="1":
        cnt_1 += 1
    else:
        break

if cnt_1>=K:
    print(1)
else:
    print(S[cnt_1])
S = list(str(input()))
K = int(input())

ones = 0
v = 0
for s in S:
    if s == '1':
        ones += 1
    else:
        v = s
        break

if ones >= K:
    print(1)
else:
    print(v)
def main():
  s=input()
  k=int(input())
  for i in s[:k]:
    if i!="1":
      print(i)
      return
  print("1")
main()
s = input()
k = int(input())

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

l = 0
for i in range(len(S)):
    if S[i] == '1':
        l += 1
    if l >= K:
        print(S[i])
        exit()
    if S[i] != '1':
        print(S[i])
        exit()
# coding: utf-8


def main():
    S = input()
    K = int(input())
    ans = '1'
    tmp = -1
    for i, s in enumerate(S):
        if s != '1':
            ans = s
            break
        else:
            tmp = i

    if K - 1 <= tmp:
        ans = '1'

    print(ans)

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

if len(s) == 1:
    print(s)
else:
    countone = 0
    for i in s:
        if i == '1':
            countone += 1
        else:
            break
    if k <= countone:
        print('1')
    else:
        print(s[countone])
s=input()
k=int(input())
for i in s:
  if i!='1':
    print(i)
    break
  else:
    k-=1
    if k==0:
      print(i)
      break
def main():
  s, k = input(), int(input())
  
  count_1 = 0
  tmp = ''
  for l in s:
    if l == '1':
      count_1 += 1
    else:
      tmp = l
      break
  if count_1 < k:
    ans = tmp
  else:
    ans = 1
    
  print(ans)

if __name__ == '__main__':
  main()
S = list(str(input()))
K = int(input())
#rint(S)
ans = 1
for i in range(K):
    #print(i)
    if S[i] != '1' :
        ans = S[i]
        break
print(ans)
s=input()
k=int(input())
a=1
for i in range(len(s)):
    if s[i]!='1':
        a=s[i]
        break
print(1 if k<=len(s) and s[0:k]=='1'*k else a)
s=input()
k=int(input())

for i in list(s[:k]):
    if i!="1":print(i);exit()
else:print(1)
S = input().strip()
K = int(input())
ind = len(S)+1
for i in range(len(S)):
    if S[i]!="1":
        ind = i+1
        break
if K<ind:
    print(1)
else:
    print(S[ind-1])
s = input()
k = int(input())

for i in range(min(len(s), k)):
    if int(s[i]) > 1:
        print(s[i])
        exit(0)

print(1)
def resolve():
	s = list(input())
	k = int(input())
	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 = list(map(int, input()))
K = int(input())
if len(S) == 1:
    print(S[0])
    exit()

cnt = 0
for s in S:
    if s == 1:
        cnt += 1
    else:
        break

if K <= cnt:
    print(1)
else:
    print(S[cnt])
s=input()
k=int(input())
t=""
if k==1:
  print(s[0])
else:
  for i in s:
    if int(i)==1:
      t+=i
    else:
      t+=i
      break
  if k>len(t):
    print(t[-1])
  else:
    print(t[k-1])
s = input()
k = int(input())
one_cnt = 0

for i in range(len(s)):
  if s[i] == '1':
    one_cnt += 1
  else:
    break

if k <= one_cnt:
  print(1)
  exit()

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

ans = 1
for i in range(k):
    if int(s[i]) != 1:
        ans = int(s[i])
        break
print(ans)
s_list = list(input())
k = int(input())
for s in s_list[:k]:
    if s != "1":
        print(s)
        exit()
print(1)
s = input()
K = int(input())
ind = 0
for i in range(len(s)):
    if s[i] != "1":
        ind = i
        break
    ind += 1

if ind == len(s):
    print(1)
else:
    if K <= ind:
        print(1)
    else:
        print(s[ind])
def main():
    S = input()
    K = int(input())
    for i in range(min(len(S), K)):
        if S[i] != '1':
            print(S[i])
            return
    print(1)
    return


main()
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 k==cnt:
            print(1)
            break
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())

not1=-1
for i in range(len(s)):
        if s[i] != "1":
                not1=i
                break

if not1==-1:
        print(1)
elif k > not1:
        print(s[not1])
else:
        print(1)
import sys
input = sys.stdin.readline

S = input()
K = input()
if len(S) <= int(K):
    a = len(S)
else:
    a = int(K)
for i in range(a):
    ans = S[i]
    if ans != '1':
        print(ans)
        exit()
print(ans)
s = input()
k = int(input())
ans = 1
for v in range(k):
    if  s[v] != "1":
        ans = s[v]
        break
print(ans)
S = list(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())
if S[0] != "1":
    print(S[0])
else:
    ind = 0
    while S[ind] == "1" and ind < len(S) - 1:
        ind += 1
    if ind < K:
        print(S[ind])
    else:
        print("1")
ns = list(map(int,input()))
n = int(input())
cnt = 1
ans = 0

for i in range(len(ns)):
  if (ns[i] == 1 and n == cnt) or ns[i] != 1:
    ans = ns[i]
    break
  else:
    cnt += 1
print(ans)
s = input()
k = int(input())

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

print(1)
s = list(input())
K = int(input())

if set(s[:K]) == {"1"}:
	print("1")
else:
	for ss in s:
		if ss != "1":
			print(ss)
			break
S = input()
K = int(input())

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

print(S[i])
def submit():
    s = str(input())
    k = int(input())

    for i, c in enumerate(s, start=1):
        if c != "1":
            if i > k:
                break
            else:
                print(c)
                return

    # 全て1 or kまで1 
    print("1")
            

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

# 1の連続性を確認し終わった段階の数字を記録
cnt = 1

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

for i in range(len(s)-1):
    if s[i] != '1':
        num = s[i]
        break
    if s[i] == s[i+1] == '1':
        cnt += 1

if cnt >= k:
    print(1)
else:
    print(num)
S = input()
K = int(input())

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

if k == 1: print(s[0])
else:
  for i in range(len(s)):
    if s[i] != "1":
      print(s[i])
      break
    elif i+1 == k:
      print(s[i])
      break
s = input()
k = int(input())
if set(s[:min(k, len(s))]) == {'1'}:
    print(1)
else:
    for si in s[:min(k, len(s))]:
        if si != '1':
            print(si)
            break
s=input()
k=int(input())

def check(i):
    global k
    global s
    
    if i==k-1:
        print(s[i])
    elif s[i]!="1":
        print(s[i])
    else:
        check(i+1)
check(0)
import sys
s=input()
k=int(input())
if k<=100:
  if s[:k]=='1'*k:
    print(1)
    sys.exit()
for i in s:
  if i!='1':
    print(i)
    break
s = str(input())
k = int(input())
if s[:k].count('1') == len(s[:k]):
    print(1)
else:
    for i in s:
        if i != '1':
            print(i)
            break
s = input()
k = int(input())
num = 0
for i in s:
    if i == "1":
        num +=1
        if num == k:
            print(1)
            exit()
    else:
        print(i)
        exit()
s = input()
k = int(input())
count = 0
for i in range(len(s)) :
    if s[i] == "1" :
        count += 1
    else :
        break
if k > count :
    print(s[count])
else :
    print("1")
s=input()
k=int(input())
cnt=0
i=0
while s[i] =="1" and i<=len(s):
    cnt+=1
    i+=1
    if i==len(s):
        break

#print(cnt)
if k<=cnt:
    print(1)
else:
    print(s[i])
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()
for i in range(k):
  if s[i]!="1":
    print(s[i])
    exit()

print(1)
S = str(input())
N = int(input())
Ones = 0
nxt = ""
for i in range(len(S)):
  if S[i] == "1":
    Ones += 1
  else:
    nxt = S[i]
    break
if N <= Ones:
  print(1)
else:
  print(nxt)
S = input()
K = int(input())
cnt = 1
for s in S:
    if s != '1':
        break
    else:
        cnt += 1


if K < cnt:
    ans = S[0]
else:
    ans = S[cnt - 1]

print(ans)
S = input()
K = int(input())

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

if ind == -1:
  print(S[0])
elif ind + 1 >= K:
  print(1)
else:
  print(S[ind+1])
s = str(input())
k = int(input())
for i in range(k):
    if s[i] != "1":
        print(s[i])
        break
else:
    print(1)
s=str(input())
n = int(input())
for i in range(n):
    if s[i] != "1":
        print(int(s[i]))
        break
else:
    print("1")
s = input()
k = int(input())
for i in range(k):
  if s[i] != "1":
      print(s[i])
      break
else:
    print(1)
#n=int(input())
#a,b,c=map(int,input().split())
#t=int(input())
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
s=list(input())
k=int(input())

if s.count("1")==len(s):
    ans="1"
else:
    for i in range(len(s)):
        if s[i]!= "1":
            break
    if k>i:
        ans=s[i]
    else:
        ans=s[i-1]
print(ans)
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    S = input().rstrip()
    k = int(input())
    
    for i in range(k):
        if S[i]!="1":
            break
    print(S[i])

if __name__=="__main__":
    main()
s, k = input(), int(input())
ans = "1"
for i in range(k):
    if s[i]!="1":
        ans = s[i]
        break
print(ans)
s = list(input())
k = int(input())
one = 0
for i in range(k+1):
    if s[i] == '1':
        one += 1
        if one == k:
            print('1')
            exit()
    else:
        print(s[i])
        exit()
S = input()
K = int(input())
ans = S[0]
for i in range(min(len(S),K)):
    if S[i] != '1':
        ans = S[i]
        break
print(ans)
S = input()
K = int(input())
mem = 1
for i in S:
  if i != "1" or mem == K: 
    print(i)
    break
  mem += 1 
else: print("1")
import sys
s = input()
k = int(input())

if k <= 100:
    a = 0
    for i in range(k):
        if s[i] != '1':
            break
        if i == str(k-1):
            print(1)
            sys.exit()
    print(s[i])
    
else:
    for i in range(100):
        if s[i] != '1':
            print(s[i])
            break
s = input()
k = int(input())
ans = 1
for i in range(k):
  if s[i] != "1":
    ans = s[i]
    break
print(ans)
def resolve():
    S = str(input())
    K = int(input())

    if S[0] != '1':
        print(S[0])
        return
    else:
        for i in range(1, K):
            if S[i] != '1':
                print(S[i])
                return
            else:
                continue
        print('1')

    return

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

for i in range(k):
    if s[i] == "1":
        continue
    else:
        print(s[i])
        exit()
print(1)
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-1<first_not_1:
    print(1)
else:
    print(S[first_not_1])
s = input()
k = int(input())
cnt1 = 0
for i in range(k):
    if s[i] == '1':
        cnt1+=1
    else:
        not1ind = i
        break
if cnt1 >= k:
    print(1)
else:
    print(s[not1ind])
s=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())
lista = list(S)

flag = 0

if(K<= len(lista)):
  for i in range(K):
    if(lista[i] != "1"):
      flag = 1
      ans = lista[i]
      break
  if(flag == 0):
    print(1)
  else:
    print(ans)

else:
  i = 0
  while True:
    if(lista[i] != "1"):
      print(lista[i])
      break
    i+= 1
# -*- 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:
            K-=1
            if K==0:
                print(1)
                exit()
        else:
            print(n)
            exit()

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