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 sys

S, K = [int(i) for i in input()], int(input())

if S[0] == 1:
    length = 1
    for i in range(1, len(S)):
        if S[i] == 1:
            length += 1
            pass
        else:
            idx = i
            break
else:
    print(S[0])
    sys.exit()

if len(S) == length:
    print(1)
else:
    if K-1 < idx:
        print(1)
    else:
        print(S[idx])

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

if s[0] != '1':
    print(s[0])
else:
    len_1 = 0
    while True:
        if s == '1':
            len_1 = 1
            ans = 1
            break
        if s[0] == '1':
            s = s[1:]
            len_1 += 1
        elif s[0] != '1':
            ans = s[0]
            break
    if k > len_1:
        print(ans)
    else:
        print('1')

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

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

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

Solution (Python):
def main():
	S = input()
	K = int(input())
	
	pos = 1
	for c in S:
		c_int = int(c)
		if c_int > 1:
			print(c)
			break
		if pos == K:
			print(c)
			break
		pos += 1



if __name__ == '__main__':
    main()

Solution (Python):
def main():
	S = input()
	K = int(input())
	
	pos = 1
	for c in S:
		c_int = int(c)
		if c_int > 1:
			print(c)
			break
		if pos == K:
			print(c)
			break
		pos += 1


if __name__ == '__main__':
    main()

Solution (Python):

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

count = 0
while s[0] == 1:
    s = s[1:]
    count += 1
    if len(s) == 0:
        break
if k <= count:
    print(1)
else:
    print(s[0])

Solution (Python):
def main():
  S = map(int,list(input()))
  K = int(input())
  for i,n in enumerate(S):
    if n == 1:
      K -= n
      continue
    if K>0:
      return n
    else:
      return 1
  return 1

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

Solution (Python):
numbers = input()
position = int(input())
answer = "1"
for num in numbers[:position]:
    if num != "1":
        answer = num
        break
print(answer)

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

while s[i] == "1":
	i += 1
	if i > len(s) - 1:
		break

if k <= len(s) and i >= k:
	print(1)
else:
	print(s[i])

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

count1 = 0
for i in S:
    if i == '1':
        count1 += 1
        if K == count1:
            print(i)
            quit()
    else:
        print(i)
        quit()

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

for i in range(len(s)) :
    if i == K - 1 :
        print(s[i])
        break
    
    if s[i] == '1' :
        continue
    else :
        print(s[i])
        break

Solution (Python):
def solve(s, k):
    for i, d in enumerate(map(int, list(s))):
        if i == k-1:
            return s[k-1]
        if d > 1:
            return d
    return 1

s = input()
k = int(input())
print(solve(s, k))

Solution (Python):
import sys

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

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

print(s[k-1])

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

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

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

cnt_1 = 0
cnt_aft_1 = None

for s in S:
  if s == '1':
    cnt_1 += 1
  else:
    cnt_aft_1 = s
    break

if len(S) == 1:
  print(S)
elif int(K) <= cnt_1:
  print('1')
else:
  print(cnt_aft_1)

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

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

Solution (Python):
N=input()
K=int(input())
res=0
for i in range(K):
  if not N[i] == "1":
    print(N[i])
    break
  else:
    res+=1
if res == K:
  print(1)

Solution (Python):

import sys
import itertools
import collections
import functools
import math
from queue import Queue

INF = float("inf")


def solve(S: int, K: int):
    n = -1
    nc = 1
    for i, c in enumerate(str(S)):
        if c != "1":
            n = i+1
            nc = c
            break
    
    if n == -1:
        print(1)
        return

    if K < n:
        print(1)
    else:
        print(nc)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  
    K = int(next(tokens))  
    solve(S, K)


if __name__ == '__main__':
    main()

Solution (Python):
S = str(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())
num=100000
for i in range(len(S)):
    if S[i]!="1":
        num=i
        T=int(S[i])
        break
if K-1<num:
    print(1)
else:
    print(T)

Solution (Python):
S = input()
K = int(input())
for i in range(K):
    if not 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 = list(input())
K = int(input())

judge = 0
count = 1
for i in range(len(S)):
  if(count == K):
    judge = 1
    ans = S[i]
    break
    
  if(S[i] == '1'):
    count += 1
  else:
    judge = 1
    ans = S[i]
    break

if((count == len(S))and(judge == 0)):
  ans = '1'
print(ans)

Solution (Python):
S=input()
K=int(input())
notoneposition=[S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1]
if notoneposition==[]:
	print(1)
else:
	notonehead=min(notoneposition)
	notone=S[notonehead]
	print(1) if K-1<notonehead else print(str(notone))

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

a = 0
for si in s:
  if si != "1":
    print(si)
    break
  else:
    if k == 1:
      print(1)
      break
    else:
      k -= 1

Solution (Python):
S = input()
K = int(input())
for i in range(len(S)):
    if int(S[i]) > 1:
        p = i
        break
else:
    print(1)
    exit()
if K-1 < p:
    print(1)
else:
    print(S[p])

Solution (Python):
S = input()
K = int(input())
L = [int(i) for i in S]
count = 1
for i in L:
    if i != 1:
        if count <= K:
            print(i)
        else:
            print(1)
        exit()
    else:
        count += 1
print(1)

Solution (Python):
S = list(map(int,input()))
K = int(input())
for i in S[:K]:
    if i > 1:
        print(i)
        break
else:
    print(1)

Solution (Python):

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

flag = 0

for i in range(len(s)):
    if flag == 0 and s[i] == 1:
        s[i] = 1
    elif flag == 0:
        s[i] = s[i]
        flag = s[i]
    else:
        s[i] = flag

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

Solution (Python):
S = input()
K = int(input())
index = len(S)-1
Num = 1
for i in range(len(S)):
  if not S[i] == '1':
    index = i+1
    Num = int(S[i])
    break
print(Num if K >= index else 1)

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

Solution (Python):
import sys
import math
import fractions
from functools import reduce
from collections import Counter
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  
def LF(): return [float(x) for x in sys.stdin.readline().split()]  
def LS(): return sys.stdin.readline().split()  
def MI(): return map(int, sys.stdin.readline().split())  
def II(): return int(sys.stdin.readline())  
def IS(): return input()  
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)


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

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

ans = ''
count = 0

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

if K <= count:
    ans = '1'


print(ans)

Solution (Python):
s = input()
k = int(input())
onesum = 0
while s[0] == "1":
    onesum += 1
    if len(s) == 1:
        break
    s = s[1:]
if k <= onesum:
    print(1)
else:
    print(s[0])

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

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

print(res)

Solution (Python):
s = list(str(input()))
n = int(input())
c = 0
for i in range(len(s)):
    if int(s[i]) == 1:
        c = c + 1
        if c == n:
            print(1)
            break
    else:
        print(s[i])
        break

Solution (Python):



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

onecnt = 0

for i in range(len(s)):
    if s[i] == "1":
        onecnt += 1
    else:
        second_str = s[i]
        break

if k > onecnt:
    print(second_str)
else:
    print("1")

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

Solution (Python):
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor, pow
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')



S = ""
K = 0


def set_inputs():
    global S, K
    S = get_str()
    K = get_int()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    x = next(itertools.dropwhile(lambda i: i < len(S) and S[i] == "1", itertools.count(0)))
    if K - 1 < x:
        print("1")
        return
    print(S[x])
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return zip(*(
        [t(x) for t, x in zip(types, input().split())]
        for _ in range(n)
    ))


if __name__ == '__main__':
    main()

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

def solve(s, k):
    n = 0
    for c in s:
        if c != '1':
            break
        n += 1

    if k <= n:
        return '1'
    else:
        return s[n]

main()

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

for x in N[:min(len(N), K)]:
  if x=='1':
    pass
  else:
    print(x)
    break
else:
  print('1')

Solution (Python):
str=input()
k=int(input())
lst=list(str)
flag=True
pos=0
for x in lst:
    if x!="1":
        flag=False
        break
    pos+=1


if flag:
    print(1)
elif k<=pos:
    print(1)
else:
    for x in lst:
        if x!='1':
            print(x)
            break

Solution (Python):
S=input()
K=int(input())
ans = ''
for i, x in enumerate(S):
    if x == '1':
        ans += x
    else:
        ans += x
        break
if len(ans)<=K:
    print(int(ans[-1]))
else:
    print(int(ans[K-1]))

Solution (Python):
s=list(input())
s=list(map(int,s))
k=int(input())
count=0
for i in range(100):
  if count==k:
    print(1)
    exit()
  if s[i]==1:
    count+=1
  else:
    print(s[i])
    exit()

Solution (Python):
s=input()
k=int(input())
on=[int(j) for j in range(2,10)]
for i in range(k):
    if int(s[i]) in on:
        print(s[i])
        break
    elif i==k-1:
        print('1')
    else:
        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()
k=int(input())
for i in range(k):
    if s[i]!='1':
        break
print(s[i])

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

if K <= n:
    print(1)
else:
    print(int(S[n]))

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

if K <= n:
    print(1)
else:
    print(int(S[n]))

Solution (Python):
S = list(input())
K = int(input())
n = 0
for i in range(len(S)):
    if S[i] != "1":
        n = i +1
        break

if K < n:
    print(1)
else:
    print(int(S[n-1]))

Solution (Python):
S = input()

K = int(input())

index = 0
res = ""

while K > index and index < len(S):
    if S[index] == "1":
        res = "1"
    else:
        res = S[index]
        break;
    index += 1

print(res)

Solution (Python):
S = input()
K = int(input())
if K < 110 and S[:K] == '1'*K:
    print(1)
else:
    print(S.replace('1', '')[0])

Solution (Python):
n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]!="1":
    i=t+1
    break
if m<i:
  print(1)
else:
  print(int(n[i-1]))

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

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

cnt = 0
for i in S:
  if i == '1':
    cnt += 1
  
  else:
    print(int(i))
    break
    
  if cnt == K:
    print(1)
    break

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

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

one_count = 0
one_end = 0
for i,s in enumerate(S):
    if s=='1':
        one_count+=1
    else:
        one_end=i
        break
if one_count>=K:
    print(1)
else:
    print(S[one_end])

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

for c in s:
  if c == "1":
    k -= 1
    if k == 0:
      print(1)
      break
  else:
    print(c)
    break

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

for c in S:
  K-=1
  if K==0:
    print(c)
    break
  if c!='1':
    print(c)
    break

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

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

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

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

if flag==1:
  print(int(num))
else:
  print(1)

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

print('1')

Solution (Python):
s,k=input(),int(input())
a=True
for i in s[:k]:
    if i!="1":
        print(i)
        a=True
        break
    a=False
if not a:
    print(1)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


def A():
    return


def B():
    return


def C():
    s = S()
    k = I()
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            quit()
    print(1)


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    C()

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

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

if S[:K].count('1') == K:
    print(1)
else:
    for s in S[:K]:
        if s != '1':
            print(s)
            break

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

if s[0] != "1":
	result = s[0]
else:
	for i in range(len(s)):
		if s[i] == "1":
			count +=1
		else:
			result = s[i]
			break
	if k > count:
		result = s[i]
	else:
		result = 1

print(result)

Solution (Python):
import sys
S = list(input())
K = int(input())
S = [int(i) for i in S]
count = 0
for i in range(K):
    if S[i] is not 1:
        print(S[i])
        sys.exit()
    else:
        count+= 1
if count == K:
    print(1)

Solution (Python):
s = raw_input()
k = int(raw_input())
count = 0
for n in s:
	count += ((int(n)**5)**10)**12
	if count>=k:
		print n
		break

Solution (Python):
S = input()
K = int(input())
init1 = -1

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

if K <= init1 + 1:
    print(1)
else:
    print(S[init1 + 1])

Solution (Python):
import re; print((lambda s: '1' if len(s) - 1 >= int(input()) else s[-1])(re.match(r'^1*[2-9]?', input()).group()))

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

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

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

Solution (Python):
s=input()
k=int(input())
def one_checker(s,k):
    for i in range(k):
        if s[i] != '1':
            return s[i]
    return '1'
result = one_checker(s,k)
print(result)

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

Solution (Python):


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

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

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

elif one_num==0:
    
    print(s[0])

else: 
    print(s[one_num])

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

Solution (Python):
S = 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())
for s in S:
    if int(s) == 1:
        K -= 1
        if K == 0:
            print(s)
            exit()
    else:
        print(s)
        exit()

Solution (Python):
S =input()
K = int(input())
L = 0
for i in range(len(S)):
    if K == i + 1:
        print(S[i])
        break
    y = int(S[i])
    if y != 1:
        print(y)
        break

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

count = 0
flag = 0

for s in S:
    if s == '1' :
        count += 1
    else:
        ans = s
        break
            
if K <= count :
    print(1)
else:
    print(ans)

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

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

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

for i,c in enumerate(s):
	if c!='1':
		break 
else:
	i = float('inf')

if k-1<i:
	print('1')
else:
	print(c)

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

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

result = "1"
for i in range( min(len(s),k) ):
    if s[i] != "1":
        result = s[i]
        break
        
print(result)

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

S = I()
K = I()

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

first_non_one_number = None
for idx, i in enumerate(str(S)):
    if i != '1':
        first_non_one_number = idx
        break

if K-1 < first_non_one_number:
    print(1)
    exit()
else:
    print(str(S)[first_non_one_number])

Solution (Python):
print(input()[:int(input())].replace('1','')[:1]or 1)

Solution (Python):
print(input()[:int(input())].replace('1','')[:1]or'1')

Solution (Python):
print(max("1",input()[:int(input())].replace("1","")[:1]))

Solution (Python):
try:print([i for i in input()[:int(input())]if i!="1"][0])
except:print(1)

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

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

mark = 0
cnt = 0
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
    else:
        cnt += 1
        if K == cnt:
            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 = input()
K = int(input())
ans = 1
for i in range(min(len(S), K)):
  if S[i] == '1':
    continue
  else:
    ans = int(S[i])
    break
print(ans)

Solution (Python):
s=input()
k=int(input())
s_=s.lstrip("1")
if k<=len(s)-len(s_):
    print(1)
else:
    print(s_[0])

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

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

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

for i in range(0, len(s)):
    if i >= k - 1 or s[i] != "1":
        print(s[i])
        break

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


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

    print(1)
    return


main()

Solution (Python):
s=input()
k=int(input())
fl=0
t=0
ans='1'
for i in range(len(s)):
  if s[i]=='1' and fl==0:
    t+=1
  else:
    if fl==0:
      ans=s[i]
      fl=1
if t>=k:
  ans='1'
print(ans)

Solution (Python):

import sys


def solve(S: str, K: int):
    S = list(map(lambda c:int(c), S))
    for i in range(len(S)):
        
        if S[i] == 1 and i+1 == K:
            print(1)
            break
        elif S[i] != 1:
            print(S[i])
            break
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  
    K = int(next(tokens))  
    solve(S, K)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
s = input()
k = int(input())
start = 0
for i in range(len(s)):
    c = s[i]
    if c!='1':
        start = i
        break

if k > start:
    print(s[i])
else:
    print(s[0])

Solution (Python):
def to_infinity(S: str, K: int) -> str:
    """5000兆 = 5e15 であり、文字 n は 5e15 日後には n^(5e15) の長さになっている。
    これは 2^100 = 10^30 より、K の範囲には確実に収まらない。
    """
    if K == 1:
        return S[0]
    
    if len(S) == 1:
        return S[0]
    
    for k in range(K):
        if k >= len(S):
            return '1'
        if S[k] != '1':
            return S[k]
    return '1'


if __name__ == "__main__":
    S = input()
    K = int(input())
    ans = to_infinity(S, K)
    print(ans)

Solution (Python):
S = input()
K = int(input())
flag = True
num = 0
ans = ''
for k in range(len(S)):
    if flag and S[k] == '1':
        num += 1
    else:
        flag = False
    if S[k] != '1':
        ans = S[k]
        break
if num >= K:
    print(1)
else:
    print(ans)

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

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

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

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

a = 0
b = 0

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

if K <= a:
    print(1)
else:
    print(b)

Solution (Python):


import itertools
import collections
import bisect

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

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


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
K = int(input())
l = 0
for i in S:
  if i == '1':
    l+=1
    if l >= K:
      break
  else:
    break
print(i)

Solution (Python):
s=list(map(int, list(input())))
k=int(input())
ans=1
for i in range(k):
    if s[i]>1:
        ans=s[i]
        break
print(ans)

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

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

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

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

Solution (Python):
st=list(input())
kn=int(input())

def ans(s,k):
    if len(s)>=k:
        for i in range(k):
            if s[i]!="1":
                return s[i]
        return 1
    else:
        for i in range(len(s)):
            if s[i]!="1":
                return s[i]
print(ans(st,kn))

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

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

Solution (Python):
def solve(string):
    s, k = string.split()
    for _s in s[:int(k)]:
        if _s != "1":
            return _s
    else:
        return "1"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Solution (Python):
def solve(string):
    s, k = string.split()
    if len(s) == 1:
        return s
    k = int(k)
    for _s in s[:k]:
        if _s != "1":
            return _s
    else:
        return "1"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Solution (Python):
def solve(string):
    s, k = string.split()
    counter = 0
    for _s in s:
        if _s == "1":
            counter += 1
            continue
        break
    return s if len(s) == 1 else "1" if int(k) <= counter else s[counter]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Solution (Python):
def solve(string):
    s, k = map(int, string.split())
    counter = 0
    for _s in str(s):
        if _s == "1":
            counter += 1
            continue
        break
    return str(s) if len(str(s)) == 1 else "1" if k <= counter else str(s)[counter]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Solution (Python):
def solve(string):
    s, k = string.split()
    if len(s) == 1:
        return s
    counter = 0
    for _s in str(s):
        if _s == "1":
            counter += 1
            continue
        break
    return "1" if len(k) < 4 and int(k) <= counter else s[counter]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Solution (Python):
def solve():
    S=input()
    K=int(input())
    for i in range(K):
        if S[i] != '1':
            return S[i]
    return S[K-1]

ans = solve()
print(ans)

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

print(result)

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

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

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

if len(S) >= int(K):
    if set(S[:int(K)]) == set(['1']):
        print('1')
        exit()

for s in S:
    if s != '1':
        print(s)
        exit()
print('1')

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

for i in range(len(s)):
    if s[i]!=1:
        ans=s[i]
        break
    else:
        num+=1
        if num==k:
            ans=s[i]
            break
        else:
            pass

print(ans)

Solution (Python):
def main():
    S = input()
    K = int(input())
    i = 0
    while S[i] == '1' and i < K-1:
        i += 1
    print(S[i])


if __name__ == "__main__":
    main()

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

for s in S:
  if s=='1':
    one_sq+=1
  else:
    break

if len(S)==1:
  print(s)
elif K<=one_sq:
  print(1)
else:
  print(S[one_sq])

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

Solution (Python):
seq=input()
k=int(input())
ans=0
con=0
for i in seq:    
    if i!="1":
        ans=i
        break
    con+=1
if con>=k:
    print(1)
else:
    print(ans)

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