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):
s = input()
k = int(input())

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

print(answer)

Solution (Python):
s = input()
k = int(input())
ans = "1"
n1 = 100
for i in range(len(s)):
    if s[i] != "1":
        ans = s[i]
        n1 = i
        break
if k-1 >= n1:
    print(ans)
else:
    print("1")

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

for i in range(min(K, len(S))):
    if S[i] > 1:
        print(S[i])
        exit()
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())
ans = 1
for i in range(len(s)):
    if s[i] != '1' and k > i:
        print(s[i])
        exit()
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
from operator import itemgetter

def main():
	s = input().strip()
	k = int(input().strip())
	ans = "1"
	for i in range(len(s)):
		if s[i] != '1' and i+1 <= k:
			ans = s[i]
			break
	print(ans)

if __name__ == '__main__':
	main()

Solution (Python):
S=input()
K=int(input())
i=0
for s in S:
  if s=='1':i+=1
  else:print(s);exit()
  if K<=i:break
print(1)

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

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())

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

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

num1 = 0

for c in s:
    if c == "1":
        num1 += 1
    else:
        break

if num1 == len(s):
    nex = s[num1-1]
else:
    nex = s[num1]
if k <= num1:
    print(1)
else:
    print(nex)

Solution (Python):
s = input()
k = int(input())
res = 1
index = 0
for i in range(len(s)):
    if s[i] != '1':
        res = s[i]
        index = i
        break
print(res if k > index else 1)

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

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

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

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

Solution (Python):
def c_to_infinity(S, K):
    for s in S[:min(K, len(S))]:
        if s != '1':
            return s  
    return '1'

S = input().strip()
K = int(input())
print(c_to_infinity(S, K))

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

n = 5 * 10 ** 15
l = 0
ans = 0
for i in S:
  if (int(i) != 1):
    ans = int(i)
    break
  else:
    l += 1
if (l >= K):
  ans = 1

print(ans)

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

def func():
    if len(S) < K:
        for s in S:
            if s != 1:
                return s
    else:
        for i,s in enumerate(S):
            if s != 1:
                return s
            if i == K-1:
                return s

print(func())

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

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

cnt = 0
while cnt<len(s) and s[cnt]=="1":
    cnt += 1

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

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

c = 0
for x in s:
    if x != '1':
        break
    c += 1

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

Solution (Python):
a = input()
d = int(input())
b = 0
c = ""
for i in range(len(a)):
    if a[i] == "1":
        b += 1
    else:
        c = a[i]
        break
print(1 if b >= d else c)

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

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

Solution (Python):
from functools import reduce
import math

def main():
    
    
    
    

    
    
    
    
    
    

    
    

    
    
    
    
    
    
    
    
    
    INF = float("inf")

    
    MOD = 10**9+7
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    S = list(int(_) for _ in input())
    K = int(input())
    for i in range(len(S)):
        if S[i] == 1 and i+1 == K:
            print(1)
            return
        elif S[i] != 1:
            print(S[i])
            return
    
if __name__ == '__main__':
    main()

Solution (Python):
S = input()
K = int(input())
   
for c in S:
    if c == '1':
        if K == 1:
            print(1)
            break
        K -= 1
        continue
    print(c)
    break

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

if len(s) == 1:
    print(s)
elif len(set(s)) == 1:
    print(s[0])
else:
    t = s.replace('1','')
    if k < len(s) - len(t):
        print(1)
    else:
        print(t[0])

Solution (Python):
s=input();k=int(input())
if len(s)>=k:
	if s[:k]=="1"*k:
		print(1);exit()
print(s.replace("1","")[0])

Solution (Python):
S = input()
K = int(input())
count_ones = 0
inf_n = 0
for c in S:
  n = int(c)
  if n == 1:
    count_ones += 1
  else:
    inf_n = n
    break
if K <= count_ones:
  print(1)
else:
  print(inf_n)

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

for i in s:
    if i == "1":
        k -= 1
        if k == 0:
            print(1)
            exit()
    else:
        print(i)
        exit()

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

Solution (Python):
s=input()
k=int(input())
num1=0
for i in s:
    if i=='1':
        num1 += 1
        if k== num1:
            print(1)
            break
    else:
        print(i)
        break

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

if n>=k:
  if sum(s[0:k])==k:
    print(s[k-1])
  else:
    print(tmp)
else:
  print(tmp)

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

Solution (Python):
S = input()
K = int(input())
l = [int(i) for i in S]
for i in range(min(S.__len__(), K)):
    if l[i] != 1:
        print(l[i])
        break
else:
    print(1)

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

if all([c == '1' for c in S]):
    print(1)
    exit(0)

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

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

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

ind = -1

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

if ind == -1:
    print(1)
else:
    print(s[ind])

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

N = min(len(S), K)
for n in range(N):
    if S[n]!='1':
        print(int(S[n]))
        break
else:
    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
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a, b = LI()
    print((a-1)*(b-1))
    return


def B():
    def est(n):
        res = 0
        for i in range(1, int(n ** 0.5) + 1):
            if not n % i:
                res += 2
        res -= float.is_integer(n ** 0.5)
        return res == 8
    n = II()
    ans = 0
    for i in range(1, n + 1, 2):
        ans += est(i)
    print(ans)
    return


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


def D():
    return


if __name__ == '__main__':
    C()

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

K = int(input())

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

Solution (Python):
s = input()
n = int(input())
 
count = 0
for i in s:
    count+=1
    if i != "1" or count == n:
        print(i)
        break
else:
    print(1)

Solution (Python):


import sys

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



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

Solution (Python):
import copy
import sys
import math

def main():
	n = int(input())
	k = int(input())
	s = str(n)
	if(k == 1):
		print(s[0])
		sys.exit()
	for i in s[:k]:
		if(i!='1'):
			print(i)
			sys.exit()
	print(1)


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()

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(len(s)):
    if s[i]!='1':
        if k<=i:
            print('1')
            exit()
        else:
            print(s[i])
            exit()
print('1')

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

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1" and idx+1 < len(s):
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>=k:
        print("1")
    else:
        print(s[idx])

Solution (Python):
s_list = list(input())
k = int(input())
for s in s_list:
  if int(s) != 1:
    print(s)
    break
  else:
    if k == 1:
      print(1)
      break
    else:
      k = k - 1

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

n = len(s)
su = 0
res = "0"
t = 0
for i in range(n):
    if s[i] == "1":
        t += 1
        if t == k:
            res = "1"
            break
    else:
        res = s[i]
        break
print(res)

Solution (Python):
a = input()
d = int(input())
b = 0
c = ""
for i in range(len(a)):
    if a[i] == "1":
        b += 1
    else:
        c += a[i]
        break
if d <= b:
    print(1)
else:
    print(c)

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

Solution (Python):
s = input()
k = int(input())
c = 0
for i in s:
  if i == "1":
    c += 1
    if c >= k:
      print("1")
      break
  else:
    print(i)
    break

Solution (Python):
S = input()
K = int(input())
N = []
for s in S:
    N.append(int(s) ** 100)

for s, n in zip(S, N):
    K -= n
    if K <= 0:
        print(s)
        break

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

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

c1 = 0
ans = S[0]
for i, s in enumerate(S):
    if s != '1':
        ans = s
        break
    c1 = i+1

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

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

n = -1
for i, ki in enumerate(s):
  if ki!='1':
    n = i+1
    break
    
if n<0 or k<n:
  print(1)
else:
  print(s[n-1])

Solution (Python):
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        break
print(S[i])

Solution (Python):
S = input()
K = int(input())
List = []
ans = 1
num = 0
for i in range(len(S)):
    List.append(int(S[i]))
for j in range(len(S)):
    if List[j] != 1:
        ans = List[j]
        num = j+1
        break
if K < num:
    print(1)
else:
    print(ans)

Solution (Python):
a = input()
b = int(input())
c = 0
d = ""
for i in range(len(a)):
    if a[i] == "1":
        c += 1
    else:
        d = a[i]
        break
if b <= c:
    print(1)
else:
    print(d)

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

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

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

res=''

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

print(res)

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

lst = [0]*100
while S > 0:
    lst.append(S%10)
    S //= 10 
lst.reverse()

j = 0
n = 0
while lst[j] == 1:
    n = j+1
    j += 1

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

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

ans = 1
count = 0

if len(S) == 1:
    ans = S[0]
else:
    for i in S:
        if i == "1":
            count += 1
        if not i == "1":
            if K > count:
                ans = i
                break
            else:
                ans = 1
print(ans)

Solution (Python):


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

if len(s)>=k and sum(s[:k-1])==k-1:
    ans=s[k-1]
else:
    for e in s:
        if e!=1:
            ans=e
            break

print(ans)

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 i in range(K):
    if S[i]=="1":
        continue
    else:
        print(S[i])
        exit()
print("1")

Solution (Python):
import re

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

if k < 100:
    oneLst = ["1"]*k
else:
    oneLst = ["1"]*100
oneStr = ''.join(oneLst)
if int(s) >= k and s[:k] == oneStr:
    print(1)
else: 
    res = re.search(r"[2-9]|0",s)
    print(res.group(0))

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

if len(S)==1:
    print(S[0])
    
else:
    lst = []
    for i in range(len(S)):
        if S[i]!='1':
            lst.append(i)
        
    if lst==[]:
        print('1')
    else:
        if K<lst[0]+1:
            print('1')
        else:
            print(S[lst[0]])

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

idx = -1
for i, ss in enumerate(s):
    if ss != '1':
        idx = i
        break

ans = ''
if idx == -1:
    
    ans = '1'
else:
    if (idx + 1) <= K:
        ans = s[idx]
    else:
        ans = '1'
print(ans)

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(S[i])
        else:
            print(1)
        exit()
else:
    print(1)

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

ans = s[0]
for i in range(min(k, len(s))):
    if s[i] != '1':
        ans = s[i]
        break

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    s = "0" + input()
    k = int(input())
    for i in range(1, len(s)):
        if s[i] != "1":
            print(s[i])
            break
        else:
            if i == k:
                print(1)
                break

if __name__ == "__main__":
    main()

Solution (Python):
S = input()
K = int(input())
ans = 1
for (offset, item) in enumerate(S):
    if item != '1':
        ans = int(item)
        break
    elif offset == K-1:
        ans = 1
        break
print(ans)

Solution (Python):
s = list((input()))
k = int(input())
if "1" in s:
	flag = True
	if k > len(s):
		k = len(s)
	for i in range(k):
		if s[i] != "1":
			if flag:
				p = int(s[i])
			flag = False
	if flag:
		print(1)
	else:
		print(p)
else:
	print(int(s[0]))

Solution (Python):
n = input()
k = int(input())
if len(n) > 1:
  for i in range(k):
    if n[i] is not '1':
      print(n[i])
      exit()
print(n[0])

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


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


ans = "1" if K-1 < i else S[i]
print(ans)

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

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

Solution (Python):
s=list(input())
k=int(input())
s.append(-1)
i=0
ans=-1
while True:
    if s[i]=="-1":
        ans=s[i]
        break
    if s[i]!="1":
        ans=s[i]
        if i+1>k:
            ans="1"   
        break
    i+=1
print(ans)

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

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

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

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

Solution (Python):
s = input()
k = int(input())
tmp = 1
t = len(s)
for i in range(len(s)):
    if s.find("1")!=0:
        tmp=s[0]
        t = i
        break
    s = s[1:]
if k > t:
    print(tmp)
else:
    print("1")

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

print(out)

Solution (Python):
import sys
input = sys.stdin.readline

S = [int(v) for v in input().strip()]
N = int(input())

for i in range(len(S)):
    v = S[i]
    
    if v == 1:
        if i + 1 == N:
            print(v)
            exit()
    else:
        print(v)
        exit()

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

Solution (Python):
S = input()
K = int(input())
for s in S:
    if s == "1":
        if K == 1:
            print(1)
            break
        K -= 1
        continue
    print(s)
    break

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

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

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

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

for i in range(len(S)):
    if S[i] == '1':
        if K == i + 1:
            print('1')
            sys.exit()
    else:
        print(S[i])
        sys.exit()

Solution (Python):
S = input()
K = int(input())
if K <= 100:
  ans = 1
  for i in range(K):
    if S[i] == '1':
      continue
    ans = S[i]
    break
  print(ans)
else:
  for si in S:
    if si == '1':
      continue
    ans = si
    break
  print(ans)

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

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

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

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

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

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

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

solve()

Solution (Python):
S = list(map(int, list(input())))
K = int(input())
result = 0
if len(S) < K:
    for s in S:
        if s != 1:
            result = s
            print(s)
            exit(0)
else:
    for s in S[:K]:
        if s != 1:
            result = s
            print(s)
            exit(0)
print(1)

Solution (Python):
import re

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

if not re.search(r'[^1]',S):
  print(1)
elif re.search(r'[^1]',S).start() >= K:
  print(1)
else:
  print(S[re.search(r'[^1]',S).start()])

Solution (Python):
s=input()
k=int(input())
cnt=0
for i in s:
  if i=="1":
    cnt+=1
  else:
    a=i
    break
print(1 if cnt>=k else a)

Solution (Python):
s=input()
k=int(input())
f=0
for i in range(k):
  if s[i]!='1':
    x=s[i]
    f=1
    break
print(x) if f==1 else 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,K,c=input(),int(input())-1,0
while c<K and S[c]=='1':c+=1
print(S[c])

Solution (Python):
S=input()
K=int(input())
c=0
a='1'
while c<K:
 if S[c]!=a:
  a=S[c]
  break
 c+=1
print(a)

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

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

Solution (Python):
S = list(input())
size = len(S)
K = int(input())
for i in range(size):
    if S[i] == "1" and K == 1 :
        print("1")
        exit()
    else :
        if S[i] == "1":
            K -= 1
        else : 
            print(S[i])
            exit()

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

first_non_one = 0
for i,s in enumerate(S):
    if s != "1":
        first_non_one = i
        break

if K <= first_non_one:
    print("1")
else:
    print(S[first_non_one])

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

for i in range(len(s)):
    if s[i] != "1":
        print(s[i])
        break
    elif i+1 == k:
        print("1")
        break

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

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

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

Solution (Python):

S = input()

K = int(input())


for i in range(K):

    if S[i] != "1":
        ans = S[i]
        break

    elif i == K - 1:
        ans = "1"

print (ans)

Solution (Python):


s = input()
k = int(input())
for i, v in enumerate(s):
    if int(v) > 1 and i+1 <= k:
        print(v)
        exit()
print(1)

Solution (Python):
s=input()
k=int(input())
count=0
for i in s:
    if i=="1":
        count+=1
    else:
        break
if count>=k:
    print(1)
else:
    print(s[count])

Solution (Python):
from sys import stdin
S = (stdin.readline().rstrip())
K = int(stdin.readline().rstrip())
cnt = 0
for i in S:
    if i == "1":
        cnt += 1
    else:
        ans = int(i)
        break
if cnt >= K:
    ans = 1
print(ans)

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

Solution (Python):
S = input()
K = int(input())
 
k = min(K,len(S))

ans = 1

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

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

i=0
while i<=len(S)-1:
    if S[i]=="1":
        i+=1
    else:
        break

if K<=i:
    print("1")
else:
    print(S[i])

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

Solution (Python):
S = input()
K = int(input())
if all(S[i] == '1' for i in range(min(len(S),K))):
    print(1)
else:
    for s in S:
        if s != '1':
            print(s)
            break

Solution (Python):
s = int(input())
k = int(input())
li = [int(k) for k in list(str(s))]

count = 0
for i in li:
  if i ==1:
    count+=1
  else:
    ans = i
    break
    
if k <= count:
  print(1)
else:
  print(ans)

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

ans_idx = 0

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

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

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

if k <= count:
    answer = '1'
else:
    answer = s[count]
print(answer)

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

Solution (Python):
S=input()
K=int(input())
c = 0
for s in S:
    c += 1
    if s != '1':
        break
        
if K < c:
    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):
def calc(S, K):
    if (K == 1):
        return S[0]

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

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

    print(calc(S, K))

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

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

print(ans)

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


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

for s in S:
  num = int(s)
  if num == 1: K -= 1
  else: K = 0
  if K <= 0:
    print(num)
    exit()

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

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  s=S()
  n=I()

  for i in range(n):
    if s[i]!='1':
      return s[i]

  return 1

print(main())

Solution (Python):
S = input()
k = int(input())
flag = False
pre = 0
cans = 0

for s in S:
    bit = format(5000000000000000-1,"b")
    temp = int(s)
    ans = 1
    for i in bit[::-1]:
        temp = (temp**2)
        if i == "1":
            ans *= temp
        if cans + ans >= k:
            print(s)
            flag = True
            break
    cans += ans
    if flag:
        break

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

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

if K < c:
    print('1')
else:
    print(s)

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

Solution (Python):

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

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

l = min(K,len(S))
if S[:l] == "1"*l :
    ans = "1"
else :
    for s in S :
        if s != "1" :
            ans = s
            break

print(ans)

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

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

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

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

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

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

res =0
for i in range(K):
    if S[i] == '1':
        if i == K-1:
            res = 1
        else:
            continue
    else:
        res = S[i]
        break
print(res)

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

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

Solution (Python):
k = input()
s = int(input())
ls = []
for i in k:
    ls.append(int(i))
    
if set(ls[0:s]) == {1}:
    print(1)
else:
    flg = 1
    for i in ls:
        flg = int(i)
        if flg !=1:
            break
    print(flg)

Solution (Python):


from math import *
from itertools import *
from collections import *


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

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

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

max_s = 1

for string in s[:k]:
    if int(string) > max_s:
        max_s = int(string)
        break

print(max_s)

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

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

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

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

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

i = 0

while s[i] == '1' and i < k-1:
  i += 1

print(int(s[i]))

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

a = 0
i = 0

while a < k:
  a += min(s[i]**70, k)
  i +=1

print(s[i-1])