Problem:
 ﻿Score: 300 points    Problem Statement  Mr. Infinity has a string S consisting of digits from 1 to 9 . Each time the date changes, this string changes as follows:   Each occurrence of 2 in S is replaced with 22 . Similarly, each 3 becomes 333 , 4 becomes 4444 , 5 becomes 55555 , 6 becomes 666666 , 7 becomes 7777777 , 8 becomes 88888888 and 9 becomes 999999999 . 1 remains as 1 .   For example, if S is 1324 , it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.
You are interested in what the string looks like after 5 \times 10^{15} days. What is the K -th character from the left in the string after 5 \times 10^{15} days?      Constraints   S is a string of length between 1 and 100 (inclusive).  K is an integer between 1 and 10^{18} (inclusive).  The length of the string after 5 \times 10^{15} days is at least K .         Input  Input is given from Standard Input in the following format:  S  K       Output  Print the K -th character from the left in Mr. Infinity's string after 5 \times 10^{15} days.        Sample Input 1 1214
4      Sample Output 1 2  The string S changes as follows:   Now: 1214  After one day: 12214444  After two days: 1222214444444444444444  After three days: 12222222214444444444444444444444444444444444444444444444444444444444444444   The first five characters in the string after 5 \times 10^{15} days is 12222 . As K=4 , we should print the fourth character, 2 .       Sample Input 2 3
157      Sample Output 2 3  The initial string is 3 . The string after 5 \times 10^{15} days consists only of 3 .       Sample Input 3 299792458
9460730472580800      Sample Output 3 2

Solution (Python):
import re

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

m = re.search(r'[2-9]', s)

if m is None or k <= m.start():
    print(1)
else:
    print(m.group())

Solution (Python):
s=str(input())
k=int(input())
cnt=0
if int(s[0])==1:
  for i in range(len(s)):
    if int(s[i])==1:
      cnt+=1
    else:
      ans=s[i]
      break
  if k<=cnt:
    print(1)
  else:
    print(ans)
  
else:
  for i in range(len(s)):
    if int(s[i])!=1:
      print(s[i])
      break

Solution (Python):
s=input()
k=int(input())
c=0
for i in range(len(s)):
    if s[i]=="1":
        if k-1==i:
            print(1)
            break
        continue
    else:
        print(s[i])
        break

Solution (Python):
s = input()
k = int(input())

turn_on = True
for i in range(min(len(s), k)):
    if s[i] == '1':
        continue
    else:
        print(s[i])
        turn_on = False
        break

if turn_on:
    print('1')

Solution (Python):
import sys

s = sys.stdin.readline().rstrip()
k = int(sys.stdin.readline())

num=0
cnt1=0
for c in s:
    if c =='1':
        cnt1 +=1
    else:
        num = c
        break


if k<=cnt1:
    print(1)
else:
    print(num)

Solution (Python):
s = input()
k = int(input())
if s[0] != "1":
  print(s[0])
else:
  
  
  
  if list(set(s[0:k]))[0] == "1" and len(set(s[0:k])) == 1:
    print(1)
  else:
    for s_s in s:
      if s_s != "1":
        print(s_s)
        break

Solution (Python):

s = 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])

Solution (Python):
s=list(map(int,list(input())))
k=int(input())
for i in range(len(s)):
    if s[i]!=1:
        if i>=k:
            print(1)
        else:
            print(s[i])
        break
else:
    print(1)
'''
N=5000000000000

def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2

x=groupby(s)

for i in x:
    i[1]=i[1]*(i[0]**N)
計算量的に間に合わないのは明らか
print(x)
'''

Solution (Python):
s = input()
k = int(input())
cnt = 0
for c in s:
    if c != "1":
        break
    cnt += 1
if k <= cnt:
    print("1")
else:
    print(s[cnt])

Solution (Python):
s=list(input())
K=int(input())
 
ANS = 1
for i in range(K):
  if s[i] != '1':
    ANS = int(s[i])
    break
print(ANS)

Solution (Python):
s = input()
k = int(input())

index = 0
for i in range(len(s)):
  if s[i] != '1':
    index = i
    break
if k-1 < index:
  print('1')
else:
  print(s[index])

Solution (Python):
s = input()
k = int(input())

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

if k <= flag:
    print(1)
else:
    print(s[i])

Solution (Python):
s = input()
k = int(input())
result = 1
for i in range(k):
  if int(s[i]) != 1:
    result = int(s[i])
    break
print(result)

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

Solution (Python):
S = [int(s) for s in list(input())]
K = int(input())

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

Solution (Python):
s = input()
k = int(input())
series_one_end = 0
for i in range(len(s)):
    if s[i] == '1':
        series_one_end = int(i + 1)
    else:
        break
if k <= series_one_end:
    print(1)
else:
    print(s[series_one_end])

Solution (Python):
s=input()
k=int(input())
for x in s:
  if x=='1':
    k-=1
    if k==0:
      print(1)
      exit()
  else:
    print(x)
    exit()

Solution (Python):
s=input()
k=int(input())

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

if k<=cnt:
    print(1)
else:
    print(ans)

Solution (Python):
S = list(input())
K = int(input())
for c in range(len(S)):
    if "1" == S[c] and c+1 < K:
        continue
    elif "1" == S[c] and c+1 <= K:
        print(1)
        exit()
    else:
        print(S[c])
        exit()

Solution (Python):
S = list(input())
K = int(input())
for s in S:
    if s != "1":
        print(s)
        exit()
    else:
        K -= 1
        if K == 0:
            print(s)
            exit()

Solution (Python):
S = input()
k = int(input())
cnt = 0
for i, s in enumerate(S):
  if s == "1":
    if i+1 == k:
      print(s)
      exit()
  else:
    print(s)
    exit()

Solution (Python):
S = input()
k = int(input())
d = {}
cnt = 0
for i, s in enumerate(S):
  if s == "1":
    cnt += 1
    if i+1 == k:
      print(s)
      exit()
  else:
    print(s)
    exit()
if cnt == len(S):
  print("1")

Solution (Python):
s=input()
k=int(input())
i=0
while True:
  if i<len(s) and s[i]=='1':
    i+=1
  else:
    break
if i==0:
  print(s[0])
  exit()
if i<k:
  print(s[i])
else:
  print(s[0])

Solution (Python):
S = input()
K = int(input())
onecount = 0

for s in S:
    if s == '1':
        onecount += 1
    else:
        answer = s
        break
if onecount >= K:
    answer = '1'
print(answer)

Solution (Python):
import re

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

m = re.search(r'[2-9]', S)
if m and m.start() < K:
    print(m.group())
else:
    print(1)

Solution (Python):



def solve():
    S = input()
    K = int(input())
    ret = 1
    for i in range(K):
        if S[i] != '1':
            ret = S[i]
            break
            
    print(ret)
    
solve()

Solution (Python):
S = str(input())
K = int(input())

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

if set(S[:K]) == set(['1']):
  print(1)
  exit()
else:
  for idx in range(K):
    if S[idx] != '1':
      print(S[idx])
      exit()

Solution (Python):
S=list(map(int,list(input())))
K=int(input())

if S[0]==1:
  if K==1:
    print(1)
  else:
    for i in range(1,len(S)):
      if S[i] != 1:
        print(S[i])
        exit(0)
      if i == K-1:
        print(1)
        exit(0)
else:
  print(S[0])

Solution (Python):
S = input()
K = int(input())

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

if ind >= K:
    print(1)
else:
    print(ans)

Solution (Python):
s = input()
k = int(input())

cnt = 0
flg = 0
for i in range(len(s)):
	if s[i] == "1":
		cnt += 1
	else:
		nxt = s[i]
		break
if cnt < k:
	print (nxt)
else:
	print (1)

Solution (Python):
s=input()
k=int(input())
if k<=len(s):
  if len(set(s[:k]))==1 and s[0]=="1":
    print(1)
    exit(0)
ans="1"
for c in s:
  if c!="1":
    ans=c
    break
print(ans)

Solution (Python):
s = input()
k = int(input())
len1 = 0
not1 = ''
for i in range(len(s)):
  if s[i] == '1':
    len1 += 1
  else:
    not1 = s[i]
    break

if k <= len1:
  print(1)
else:
  print(not1)

Solution (Python):
S = input()
K = int(input())
cnt = 0
for s in S:
    cnt += 1
    if s == "1" and cnt < K:
        continue
    else:
        print(s)
        exit()

Solution (Python):
S = str(input())
K = int(input())
L = []

count = 0
for s in S:
    count += 1
    if s != '1':
        t = s
        break
    t = s

if K < count:
    print(1)
else:
    print(int(t))

Solution (Python):
S = list(input())
K = int(input())


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

Solution (Python):
import sys
sl = list(input())
k = int(input())

for s in sl:
    s = int(s)
    k -= 1
    if k == 0:
        print(s)
        sys.exit()
    if s > 1:
        print(s)
        sys.exit()

Solution (Python):
S=input()
K=int(input())
flag=0
for i in range(K):
    if S[i]!='1':
        print(S[i])
        flag=1
        break
if flag==0:
    print(1)

Solution (Python):
n=input()
k=int(input())
if len(n)==1:
    print(n)
    exit()
cnt=0
for i in n:
    if i=="1":
        cnt+=1
    else:
        x=i
        break
print(1 if cnt>=k else x)

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

Solution (Python):
s = input()
k = int(input())
for char in s:
  if char != "1":
    print(char)
    break
  elif char == "1":
    k -= 1
    if k == 0:
      print(1)
      break

Solution (Python):

s=input()
k=int(input())
cnt=0
while(s[cnt]=='1' and cnt!=len(s)-1):
    cnt+=1
if(k-1<cnt):
    print('1')
else:
    print(s[cnt])

Solution (Python):
S = input()
K = int(input())
flag = 0
ans = 0
for i in range(len(S)):
    if S[i] == "1":
        flag += 1
    else:
        ans = S[i]
        break

if flag >= K:
    print(1)
else:
    print(ans)

Solution (Python):
s = input()
k = int(input())

i = 0
while i < k - 1 and i < len(s):
    if s[i] != '1':
        break
    i += 1
print(s[i])

Solution (Python):
s = input()
k = int(input())
if len(s) == 1 or k == 1:
    print(s[0])
else:
    i = 0
    while i < k - 1 and i < len(s):
        if s[i] != '1':
            break
        i += 1
    print(s[i])

Solution (Python):
s = list(input())
k = int(input())

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

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

Solution (Python):
s = str(input())
k = int(input())

ans = s[0]
cnt = 0
i=0
while i<len(s):
    cnt += int(s[i])**(5*(10*15))
    if (cnt >= k):
        ans = s[i]
        break
    i+=1
print(ans)

Solution (Python):
s=list(input())
k=int(input())
if len(s)==1 or k==1:
    print(int(s[0]))
else:
    for i in range(len(s)):
        if int(s[i])==1 and i!=len(s)-1 and (i+1)<k:
            continue
        else:
            print(int(s[i]))
            break

Solution (Python):
S = input()
K = int(input())
c = 0
for i, s in enumerate(S):
  if s != '1':
    c = i + 1
    break
  
if K < c:
  print(1)
else:
  print(S[c - 1])

Solution (Python):
import sys
s = input()
k = int(input())
l = len(s)
for i in range(k):
    if s[i]!="1":
        print(s[i])
        sys.exit()
print("1")

Solution (Python):
S = input()
K = int(input())
firstNot1 = ([i for i in range(len(S)) if S[i] != '1'] + [len(S)])[0]

print('1' if firstNot1 >= K else S[firstNot1])

Solution (Python):
a = list(input())
k = int(input())

for i in a:
    if i != '1':
        print(i)
        break
    k -= 1
    if k == 0:
        print('1')
        break

Solution (Python):
S = input()
K = int(input())
for i,c in enumerate(S):
    if c!='1': break
print(1 if c=='1' or K<i+1 else c)

Solution (Python):
s = input()
k = int(input())

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

Solution (Python):
S = input()
K = int(input())
if S[0]*len(S) == S and S[0] == "1":
    print("1")
else:
    ans = 0
    ind = 0
    for i in range(len(S)):
        if S[i] != "1":
            ans = S[i]
            ind = i+1
            break
    if ind > K:
        print("1")
    else:
        print(ans)

Solution (Python):
from sys import stdin

s = stdin.readline().rstrip()
k = int(stdin.readline().rstrip())

zantei = 1
kai = 0
for i in s:
    if i == "1":
        kai += 1
    else:
        zantei = int(i)
        break

if zantei == 1:
    print(1)

elif kai >= k:
    print(1)
else:
    print(zantei)

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

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    s=input()
    k=int(input())
    for i in range(k):
        if(s[i]!='1'):
            print(int(s[i]))
            return
    print(1)
resolve()

Solution (Python):
s=input()
n=int(input())
ans=1
for i in range(n):
    if s[i]!='1':
        ans=s[i]
        break
    else:
        continue
print(ans)

Solution (Python):
s = input()
k = int(input())
i = 0
if s.count('1') == len(s):
    print(1)
else:
    while s[i] == '1':
        i += 1
    print([1, s[i]][i < k])

Solution (Python):
s = input()
k = int(input())

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

Solution (Python):
s=list(input())
k=int(input())

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

Solution (Python):




import sys














def main():
    s = sys.stdin.readline().rstrip()
    k = int(sys.stdin.readline().rstrip())

    count = 0
    for i in range(len(s)):
        if s[i] == '1':
            count += 1
        else:
            last_1 = i - 1
            break
    else:
        last_1 = len(s) - 1
    
    if k <= count:
        ans = '1'
    else:
        ans = s[last_1 + 1]
    
    print(ans)
    



if __name__ == "__main__":
    
    main()

Solution (Python):
S = input()
K = int(input())
non1pos = 0
for i in range(len(S)):
    if (S[i] != '1'):
        non1pos = i
        break
if (non1pos >= K):
    print(1)
else:
    print(S[non1pos])

Solution (Python):
S = list(input())
K = int(input())
count = '1'
for n in range(K):
    if S[n] != '1':
        count = S[n]
        break
print(count)

Solution (Python):
s = input()
k = int(input()) - 1
 
cnt1 = 0
for i in range(len(s)):
  if s[i] == '1':
    cnt1 += 1
  else:
    break
 

if cnt1 > k:
  print(1)
else:
  print(s[cnt1])

Solution (Python):
S = input()
k = int(input())

for i, s in enumerate(S):
    if s != "1":
        print(s)
        break
    elif i + 1 == k:
        print(1)
        break
else:
    print(1)

Solution (Python):
S = input()
K = int(input())

con = 0

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

if K <= con:
  print(1)
else:
  if S[0] == "1":
    S = S.replace("1","")
    print(int(S[0]))
  else:
    print(int(S[0]))

Solution (Python):
s = input()
k = int(input())

i = 1
while i <= k:
    if s[i-1] != '1':
        print(s[i-1])
        break
    elif i == k:
        print(s[i-1])
        break
    i += 1

Solution (Python):
s = input()
k = int(input())

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

if k == 1:
    print(s[0])
else:
    i = 1
    while i <= k:
        if s[i-1] != '1':
            print(s[i-1])
            break
        elif i == k:
            print(s[i-1])
            break
        i += 1

Solution (Python):
S = input()
K = int(input())

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

Solution (Python):
S=input()
if all(S[i]=="1" for i in range(len(S))):
  print(1)
elif S[0]!="1":
  print(S[0])
else:
  K=int(input())
  i=0
  while S[i]=="1":
    i+=1
  if i<K:
    print(S[i])
  else:
    print(1)

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

Solution (Python):
S = input()
K = int(input())
for i, s in enumerate(S):
    if s != '1':
        break
if K <= i:
    print(1)
else:
    print(s)

Solution (Python):
s = input()
k = int(input())

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

Solution (Python):
s=input()
k=int(input())
p=5*(10**15)
l=[]
n=len(s)
for i in range(n):
    if s[i]!='1':
        print(s[i])
        exit()
    elif i+1>=k:
        print(s[i])
        exit()
print(1)

Solution (Python):
S = str(input())
K = int(input())

flag = True
for i in range(min(len(S), K)):
    if S[i] == "1":
        pass
    else:
        if i < K:
            print(S[i])
            exit()
print(1)

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

Solution (Python):
N, K = [int(input()) for _ in range(2)]
listn = list(str(N))
a = []
if len(str(N)) < K:
    for i in range(len(str(N))):
        if listn[i] != str(1):
            a.append(str(listn[i]))
else:
    for i in range(K):
        if listn[i] != str(1):
            a.append(str(listn[i]))
if a == []:
    print(1)
else:
    print(a[0])

Solution (Python):
s=input()
k=int(input())

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

print(1 if k<i+1 else int(s[i]))

Solution (Python):
S = [int(x) for x in input()]
K = int(input())
if S[0] != 1:
    one = 0
    answer = S[0]
else:
    one = 0
    for i in range(len(S)):
        if S[i] == 1:
            one += 1
        else:
            break
    if one >= K:
        answer = 1
    else:
        answer = S[one]
print(answer)

Solution (Python):
s = input()
k = int(input())
if all(i=='1' for i in s[:k]):
  print(1)
  quit()
for i in s:
  if int(i)>=2:
    print(i)
    quit()

Solution (Python):

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


if __name__ == "__main__":
    main()

Solution (Python):
s = input()
k = input()

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

Solution (Python):
s=input()
n=len(s)
k=int(input())
t=5*10**15
for i in range(n):
    a=int(s[i])
    if a==1:
        k-=1
    else:
        print(a)
        break
    if k<=0:
        print(1)
        break

Solution (Python):
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)

Solution (Python):
S = input().strip()
K = int(input().strip())

i = 0
while S[i] == '1' and i < len(S) - 1:
    i += 1

print(S[i] if K > i else 1)

Solution (Python):
S = input()
K = int(input())
for i in range(K):
    if S[i] != "1":
        print(int(S[i]))
        exit()
else:
    print("1")

Solution (Python):
S=input()
K=int(input())
f1=True
for i in range(K):
    if S[i]!='1':
        print(S[i])
        f1=False
        break
if f1:
    print('1')

Solution (Python):

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

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

Solution (Python):
S=input()
K=int(input())
F=1
for i in range(K):
  if(S[i]!='1'):
    print(S[i])
    F=0
    break
if(F):
  print(1)

Solution (Python):
def solve(s, k):
    for i, c in enumerate(s, 1):
        if i == k:
            return c
        if c != '1':
            return c


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

print(solve(s, k))

Solution (Python):
S = input()
K = int(input())
for i in range(K):
    if S[i] == "1":continue
    print(S[i]);exit()
else:print(1)

Solution (Python):
S = input()
k = int(input())

if S[0] == '1':
    cnt = 0
    for s in S:
        if s == '1':
            cnt += 1
        else:
            not1 = s
            break
    if k <= cnt:
        print(1)
    else:
        print(not1)
else:
    print(S[0])

Solution (Python):
s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != '1' and i < k:
        print(s[i])
        exit()
print('1')

Solution (Python):
S=input()
K=int(input())

i=0
while S[i]=='1' and i<len(S)-1:
    i+=1

print([1,S[i]][K>i])

Solution (Python):
import sys
S = input()
K = int(input())

for i in range (0,len(S)):
  if (i <= K-1) and (int(S[i]) != 1):
    print(int(S[i]))
    sys.exit()
print("1")

Solution (Python):
S = input()
K = int(input())
c = 0
for i in range(len(S)):
    if S[i] == '1':
        c += 1
        if c == K:
            print('1')
            exit()
    else:
        print(S[i])
        exit()

Solution (Python):
s = list(input())
k = int(input())-1
s = s[:k+1]
nums = ["2","3","4","5","6","7","8","9"]

ans_idx = k
for n in nums:
    if n not in s:
        continue
    cur_idx = s.index(n)
    ans_idx = min(ans_idx,cur_idx)

print(s[ans_idx])

Solution (Python):
s = list(input())
k = int(input())

if len(set(s[:k])) == 1 and s[0]=="1":
  print(1)
else:
  for ss in s[:k]:
    if int(ss) != 1:
      print(ss)
      break
    else:
      continue

Solution (Python):
S = input()
K = int(input())

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

if K > i:
    print(S[i])
else:
    print(1)

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

Solution (Python):
S=input()
k=int(input())

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

Solution (Python):

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

start = 1
pos = 0
for i in range(len(S)):
    if 1 != int(S[i]) and i < K:
        start = int(S[i])
        pos = i
        break


print(start)

Solution (Python):
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce



def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




s = getInputInt()
k = getInputInt()

data = list(str(s))

ans = 1

for i in range(len(data)):
    if int(data[i]) != 1 and i < k:
        ans = int(data[i])
        break

print(ans)

Solution (Python):

S = input()
K = int(input())
cnt = 0
for s in S:
    if s == "1":
        cnt += 1
    else:
        break
if cnt >= K:
    print(1)
else:
    print(int(S[cnt]))

Solution (Python):
s=input()
S=[0]*len(s)
for i in range(len(s)):
  S[i]=int(s[i])
k=int(input())
ans=0
if len(s)>=k:
  if sum(S[:k])==k:
    print(1)
    ans=1
if ans!=1:
  for i in range(len(S)):
    if S[i]!=1:
      print(S[i])
      break

Solution (Python):
S = input()
K = int(input())

n = 0
for si in S:
    if si == '1':
        n += 1
    else:
        break






if n >= K:
    print('1')
else:
    print(S[n])

Solution (Python):
S = input()
K = int(input())

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

Solution (Python):
S = input()
K = int(input())

for s in S :
    if s == '1' :
        K -= 1
    else :
        print(s)
        break
    
    if K == 0 :
        print(1)
        break

Solution (Python):
S = input()
K = int(input())

if S[0] == '1':
    counter = 1
    for s in S:
        if s != '1' or counter >= K:
            print(s)
            break
        counter += 1 
else:
    print(S[0])

Solution (Python):
S = str(input())
K = int(input())
for i,x in enumerate(S):
    if x=='1' and K<=i+1:
        print('1')
        break
    elif x!='1':
        print(x)
        break

Solution (Python):
S=list(input())
K=int(input())

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

print(1)

Solution (Python):

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

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

print(1)

Solution (Python):
S = input()
K = int(input())

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

Solution (Python):
S = input()
K = int(input())




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

Solution (Python):
S = input()
K = int(input())




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

Solution (Python):
S = '0' + input()
K = int(input())
days = 5*(10**13)
idx1 = 1
idx2 = 0
while idx2 < K:
  ans = S[idx1]
  if int(S[idx1]) == 1:
    idx2 += 1
  else:
    tmp_idx = int(S[idx1])
    tmp_cnt = 1 
    while tmp_idx + idx2 < K and tmp_cnt <= days:
      tmp_idx *= int(S[idx1])
      tmp_cnt += 1
      
    
    if tmp_cnt == days:
      print(S[idx1])
      eixt()
    else:
      idx2 += tmp_idx
  idx1 += 1
  
print(ans)

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    k = int(input().rstrip('\n'))
    cnt = 0
    for i in range(len(s)):
        if s[i] == "1":
            cnt += 1
        else:
            break
    print(1 if cnt >= k else s[cnt])


if __name__ == '__main__':
    slove()

Solution (Python):


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

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

Solution (Python):
s = input()
k = int(input())

ct = 0
for i in range(len(s)):
    if s[i] != '1':
        ct += i+1
        break

if ct > k:
    print(1)
else:
    print(s[ct-1])

Solution (Python):

def solve(s, k):
    for si in s:
        if k == 1:
            return si
        elif si == '1':
            k -= 1
        else:
            return si


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

Solution (Python):
S = str(input())
K = int(input())
N = len(S)
x = 1
i = 0
while int(x) == 1:
  x = S[i]
  
  i += 1
  if (i == N) & (int(x) == 1):
    x = -1
i -= 1

x = int(x)    
if x == -1:
  print(1)
  quit()
  
if i >= K:
  print(1)
else:
  print(x)

Solution (Python):
S = input()
K = int(input())
flg = True
for i in range(K):
    if len(S) <= i:
        break
    if S[i] != '1':
        flg = False
if flg:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
print('1')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S= input()
K = INT()

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

Solution (Python):
S = list(input())
K = int(input())

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

Solution (Python):
def main():
    s = input()
    k = int(input())

    for c in s:
        if c == '1':
            k -= 1
            if k == 0:
                return c
        else:
            return c


if __name__ == '__main__':
    print(main())

Solution (Python):
s = input()
k =int(input())
res = 1
for i in range(k):
    if s[i] != "1":
        res = s[i]
        break

print(res)

Solution (Python):
s = input()
k = int(input())

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

Solution (Python):
S = input()
K = int(input())
for i in range(min(len(S),K)):
  if int(S[i]) >= 2:
    print(S[i])
    exit()
print(1)

Solution (Python):
S = input()
K = int(input())
key = []
if S.count("1") == len(S):
  print(1)
else:
  for i in range(len(S)):
    if S[i] != "1":
      key.append([i,S[i]])
      break
  if K - 1 < key[0][0]:
    print(1)
  else:
    print(key[0][1])

Solution (Python):
s  = list(map(int, input()))
k = int(input())

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

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

Solution (Python):
s, k = input(), int(input())
cnt=0
for i in s:
  if i!="1":ans=i;break
  cnt+=1
if cnt>=k: ans=1
print(ans)

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))


s = input()
k = inp()
n = min(len(s), k)
for i in range(n):
    if s[i] != '1':
        print(s[i])
        break
else:
    print(1)

Solution (Python):
n = input()
k = int(input())


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

Solution (Python):

s=input()
k=int(input())
count=0
for i in s:
    if i=='1':
        count+=1
    else:
        ans=i
        break
if k<=count:
    print(1)
else:
    print(ans)

Solution (Python):
s = [int(_) for _ in input()]

k = int(input())

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

print(ans)

Solution (Python):
def test():
    s = input()
    k = int(input())
    n = len(s)
    if n == 1:
        print(int(s))
        return
    else:
        if all(int(s[i])==1 for i in range(k)):
            print(1)
            return
        else:
            for i in range(k):
                if int(s[i]) != 1:
                    print(int(s[i]))
                    return


if __name__ == "__main__":
    test()

Solution (Python):
S = input()
K = int(input())

cnt1 = 0
last = ''
for s in S:
    if s == '1':
        cnt1 += 1
    else:
        last = s
        break

if K <= 100 and cnt1 >= K:
    print('1')
else:
    print(last)

Solution (Python):
s=list(x for x in input())
k=int(input())
for i in range(len(s)):
  if k > i+1:
    if s[i] != '1':
      print(s[i])
      break
    else:
      continue
  elif k == i+1:
    print(s[i])
    break

Solution (Python):
S = input()
K = int(input())

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

Solution (Python):
S=input()
K=int(input())
N=len(S)

i=0
while i<K:
  if S[i]=='1':
    i+=1
  else:
    print(S[i])
    exit()

print(1)