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

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

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

print(ans) if ans else print(1)

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

cntone=0
while len(s)>cntone and s[cntone]=='1':
    cntone+=1

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

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

Solution (Python):
from collections import deque
S=deque(list(map(int,list(input()))))
K=int(input())
i=0
while S:
    if S[0]==1:
        S.popleft()
        i+=1
    else:
        break
result=1 if K<=i else S[0]
print(result)

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

if len(S) >= K and S[:K] == "1"*K:
    print(1)
else:
    for S in list(S):
        if S != "1":
            print(S)
            break

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    K = int(readline())
    K -= 1

    idx = 0
    for i, c in enumerate(S):
        if c != '1':
            idx = i
            break
    if idx > K:
        print(1)
    else:
        print(S[idx])

    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = list(map(int, (list(ns()))))
    K = ni()
    for i in range(K):
        if S[i] != 1:
            print(S[i])
            return
    print(1)


if __name__ == '__main__':
    main()

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 main():
    S = input()
    k = int(input())
    for s in S[:k]:
        if s != '1':
            print(s)
            break
    else:
        print(1)


if __name__ == '__main__':
    main()

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

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

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

    m = 0
    ans = ""

    for i in range(len(s)):
        if s[i] != "1":
            m = i+1
            ans = s[i]
            break
    
    if k < m:
        print(1)
    elif m == 0:
        print(1)
    else:
        print(int(ans))



if __name__ == "__main__":
    main()

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

Solution (Python):
s = input().rstrip()
n = int(input().rstrip())

if s[:n].count('1') == n:
    print(1)
else:
    print(s.replace('1', '')[0])

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

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

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

Solution (Python):
S = input()
k = int(input())
for i, s in enumerate(S, start=1):
    if s != "1":
        print(s)
        break
    if i == k:
        print(1)
        break

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

Solution (Python):
S=(input())
s=list(S)
K=int(input())
if K==1:
  print(s[0])
  exit()
for i in range(K):
  key=s[i]
  if key!='1':
    print(key)
    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())

cnt = 0
for i in range(len(s)):
    num = int(s[i])
    if num == 1:
        cnt += 1
        if cnt == k:
            print(num)
            break          
    else:
        print(num)
        break

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

Solution (Python):
s = input()
k = int(input())
if s[0] != "1":
    print(s[0])
elif s[:k].replace("1","")=="":
    print("1")
else:
    print(s.replace("1","")[0])

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

for i, s in enumerate(S, 1):
    if i == K:
        print(s)
        exit()

    if s != "1":
        print(s)
        exit()

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

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

Solution (Python):
s=input()
for i in range(int(input())):
  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])
    break
else:
  print(1)

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

for i in s:
    if int(i)!=1:
        print(i)
        exit()
    k-=1
    if k<1:
        print(1)
        exit()

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

ans = -1
for s in S[:K]:
  x = int(s)
  if x != 1:
    ans = x
    break
else:
  ans = 1

print(ans)

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

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

Solution (Python):
s = input()
k = int(input())
cnt = 0
for l in s:
  if l!='1':
    break
  cnt += 1
if cnt>=k:
  print(1)
else:
  print(s[cnt])

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

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

print(ans)

Solution (Python):





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

whileone=-1
ans=-1
for i in range (len(S)):
    if S[i]=="1":
        whileone=i+1
    else:
        ans=S[i]
        break

if whileone>0 and whileone>=K:
    print(1)
else:
    print(ans)

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

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

Solution (Python):


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


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

print(s[i])

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 s in S:
    if K != 1 and s == '1':
        K -= 1
        continue
    else:
        print(s)
        break

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

Solution (Python):


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


pos = None

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



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

Solution (Python):
import re

m = re.match(r'\A(1*)([1-9]*)\Z', input())
print('1' if len(m.group(1)) >= int(input()) else m.group(2)[0])

Solution (Python):
import re

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

m = re.match(r'\A(1*)([1-9]*)\Z', S)
print('1' if len(m.group(1)) >= K else m.group(2)[0])

Solution (Python):
import re

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

m = re.match(r'\A(1+)([1-9]*)\Z', S)
if m:
    print('1' if len(m.group(1)) >= K else m.group(2)[0])
else:
    print(S[0])

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

Solution (Python):
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  

S = LI2()
K = I()

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

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

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

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

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

if K <= count:
    print(1)
else:
    print(xString)

Solution (Python):


import math

import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd


s=input()
k=int(input())
c=0
for a in s:
    if a!="1":
        ans=a
        break
    else:
        c+=1
if k<=c:
    print(1)
else:
    print(ans)

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

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

print(1)

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




























































def calculation(lines):
    
    S = lines[0]
    K = int(lines[1])
    n_seq1 = get_n_seq1(S)
    if n_seq1 >= K:
        return [1]
    else:
        return [S.replace('1', '')[0]]
    return [cnt]


def get_n_seq1(S):
    ret = 0
    for i in range(len(S)):
        if S[i] == '1':
            ret += 1
        else:
            return ret
    return ret



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['1214', '4']
        lines_export = ['2']
    if pattern == 2:
        lines_input = ['3', '157']
        lines_export = ['3']
    if pattern == 3:
        lines_input = ['299792458', '9460730472580800']
        lines_export = ['2']
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode



def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    



if __name__ == '__main__':
    main()

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

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

Solution (Python):
S,K=list(input()),int(input())
for i in S:
    K-=1
    if i!='1'or K==0:
        print(i)
        exit()

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

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

print(S[k])

Solution (Python):
if __name__ == '__main__':

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

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

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

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

Solution (Python):
import sys
A = str(input())
B = int(input())
count = 0

for i in range(len(A)):
    if A[i] == "1":
        count += 1
    else:
        if B <= count:
            print(1)
            sys.exit()
        else:
            print(A[i])
            sys.exit()
print(1)

Solution (Python):
import sys
A = str(input())
B = int(input())
count = 0

for i in range(len(A)):
    if A[i] == "1":
        count += 1
    else:
        if B <= count:
            print(1)
            sys.exit()
        else:
            print(A[i])
            sys.exit()
print(1)

Solution (Python):
s=list(input())
k=int(input())
ch=0
for i in range(len(s)):
  if s[i]=='1':
    ch+=1
  else:
    ss=s[i]
    break
    
if ch>=k:
  print(1)
else:
  print(str(ss))

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

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

Solution (Python):
s = list(input())
k = int(input())
n = min(len(s), k)

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

print(1)

Solution (Python):

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left, bisect_right 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

for i, s in enu(S):
    if s != '1':
        print(s)
        exit()
    if i == K-1:
        print(s)
        exit()

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

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

print(S[i])

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

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

Solution (Python):
S = input()
K = int(input())
if S[:K].count("1") == K:
    print(1)
    exit()
A = S.lstrip("1")
print(A[0])

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

for i, a in enumerate(s):
    if a != "1":
        ans = 1 if k<=i else int(a)
        break
else:
    ans = 1
print(ans)

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

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

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

if judge != 0:
    print("1")

Solution (Python):
S =input()
K = int(input())
if S.count("1") == len(S):
  print(1)
else:
  for i in range(len(S)):
    if S[i] != "1":
      print(S[i])
      break
    elif i+1 == K:
      print(S[i])
      break

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

K = int(input())

num_digit = 0

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

Solution (Python):
import sys
s = input()
n = int(input())
cnt = 0
if n == 1:
	print(s[0])
	sys.exit()
for i in s:
	if i == '1':
		cnt += 1
	else:
		break
if n <= cnt:
	print(1)
	sys.exit()
	
for i in s:
	if i != '1':
		print(i)
		sys.exit()
print(1)

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

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

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):
S=list(input())
K=int(input())
a=b=0

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

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

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

print(1)

Solution (Python):
S = input()
K = int(input())
Flag = True
for T in range(0,min(K,len(S))):
    if S[T]!='1':
        Disp = S[T]
        Flag = False
        break
if Flag: print('1')
else: print(Disp)

Solution (Python):
S = 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':
                break
        if i <= K - 1:
            print(S[i])
        else:
            print('1')
else:
    print(S[0])

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

c1 = 0
num = ""
for c in s:
    if c == "1":
        c1 += 1
    else:
        num = c
        break

if k <= c1:
    print("1")
else:
    print(num)

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

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

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

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

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

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

Solution (Python):
elems = map(int,list(raw_input()))
k = int(raw_input())

for v in elems:
	if v == 1: 
		k -=1
	else: k = 0
	if k <= 0:
		print v
		break

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

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

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

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    ans = ''
    index = 0
    s = input().rstrip('\n')
    k = int(input())
    for i in range(len(s)):
        if s[i] != '1':
            ans = s[i]
            index = i
            break
    if ans == '' or k < index+1:
        ans = '1'
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):

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

i = 0
while i < len(s) - 1:
    if i == k - 1:
        print(s[i])
        exit()
    if s[i] == "1":
        i += 1
    else:
        print(s[i])
        exit()
print(s[i])

Solution (Python):
def main():
    s = input()
    k = int(input())
    r = '1'
    for i,v in enumerate(s):
        if v != '1':
            r = v
            break
    if i >= k:
        print(1)
    else:
        print(r)
    
if __name__ == "__main__":
    main()

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

S = list(input().rstrip('\n'))
K = int(input())

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

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

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

print(ans)

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

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

if s[0] == "1":
    if k == 1:
        print(1)
        exit()
    else:
        for i in range(len(s)):
            if s[i] == "1":
                continue
            elif (s[i] != "1") and (i+1 <= k):
                print(s[i])
                exit()
            elif (s[i] != "1") and (i+1 > k):
                print(1)
                exit()
        print(1)
        exit()

elif s[0] != "1":
    print(s[0])
    exit()

Solution (Python):
import sys

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

for s in S[:min(len(S),K)]:
    if s=="1":
        pass
    else:
        print(s)
        sys.exit()
print(1)

Solution (Python):
def solve():
    S = input()
    K = int(input())
    for i in range(len(S)):
        if S[i] != '1':
            print(S[i])
            exit()
        elif i == K - 1:
            break
    print(1)


if __name__ == "__main__":
    solve()

Solution (Python):
s = list(input())
k = int(input())
ans = "1"
cnt = 0
for i in s:
    if i == "1":
        cnt += 1
    elif cnt < k:
        ans = str(i)
        break
print(ans)

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

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

n = len(s)
if n == 1 or k == 1: print(s[0])
else:
  for i in range(n):
    if s[i] == "1":
      k -= 1
      if k == 0: 
        print(s[i])
        break
    else:
      print(s[i])
      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(min(len(S),K)):
  if S[i]>="2":
    print(S[i])
    exit()
print("1")

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

for s_idx,s in enumerate(S):
    s=int(s)
    if s!=1:
        print(s)
        break
    elif s_idx + 1 == K:
        print(s)
        break

Solution (Python):
S=input()
K=int(input())
for i in range(min(len(S),K)):
  if S[i]>="2":
    print(S[i])
    exit()
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=input();
i = 0;
for i in range(len(S)) :
    if int(S[i]) > 1 :
        print(S[i]);
        break;
    elif i + 1 >= int(K) :
        print(1);
        break;

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

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

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

    
if count < K:
    print(S[count])
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=list(map(int,tuple(input())))
k=int(input())
i=0
if 1 in s:
  for i in range(len(s)):
    if s[i]!=1:
      break
  if i>=k:
      print(1)
  else:
      print(s[i])
else:
  print(s[0])

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

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

Solution (Python):

def solve():
    j = 1
    for i in s:
        if i != 1:
            print(i)
            exit()
        if j==K:
            print(i)
            exit()
        j += 1
    print(1)

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

    s = [int(c) for c in S]

    solve()

Solution (Python):
import sys
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    S = list(map(int, in_s()))
    N = len(S)
    K = in_n()

    one_i = -1
    for i in range(N):
        if S[i] == 1:
            one_i = i
        else:
            break

    if K <= one_i + 1:
        print(1)
    else:
        ind = min(N - 1, one_i + 1)
        print(S[ind])


if __name__ == '__main__':
    main()

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

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

    return

resolve()

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())
count = 0
for i in S:
    if i == '1':
        count += 1
    else:
        break

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

Solution (Python):
s=list(input())
k=int(input())
for i in range(len(s)):
    if s[i]!="1":
        p=i+1
        pnum=int(s[i])
        break
    p=101

if k<p:
    print(1)
else:
    print(pnum)

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

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

Solution (Python):
s = input()
k = int(input())
rep = s.replace("1", "")
if len(rep) == 0:
  print("1")
else:
  if s.index(rep[0]) < k:
    print(rep[0])
  else:
    print("1")

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

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

Solution (Python):
from collections import defaultdict
def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

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

print(1)

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

Solution (Python):





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

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

Solution (Python):
s = input()
k = int(input())
if s == '1' * len(s):
  print(1)
  exit()
for i in range(len(s)):
  if s[i] != '1':
    idx = i
    num = s[i]
    break
if idx >= k:
  print(1)
else:
  print(num)

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


if __name__ == "__main__":
    main()

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

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

main()

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


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

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

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())
cnt = 0

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

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

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

S = X()
K = i()

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

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

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

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

if s[0] > 1:
  print(s[0])
elif sum(s[0:k]) == k and len(s[0:k]) == k:
  print(1)
else:
  i = 0
  while s[i] == 1:
    i += 1
    if s[i] != 1:
      print(s[i])
      break

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

Solution (Python):
s=input()
k=int(input())
if k==1 or len(s)==1:
  print(s[0])
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 == 1:
    print(s[0])
else:
    count = 0
    for i, v in enumerate(s, 1):
        if v == '1':
            count += 1
        else:
            tmp = v
            break

    if count >= k or count ==len(s) :
        print(1)
    else:
        print(tmp)

Solution (Python):
s=input()
k=int(input())
flag=True
i=0
while flag:
    if i==len(s):
        break
    elif s[i]!="1":
        res=s[i]
        flag=False
    else:
        i+=1
if k>i:
    print(res)
else:
    print(1)

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    s = input()
    k = I()
    for i, si in enumerate(s):
        if si != '1':
            print(si)
            sys.exit()
        if i == k-1:
            break
    print(1)

if __name__ == '__main__':
    main()