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())
limit=0
for i in range(len(S)):
    if S[i] !='1':
        limit =i
        break
if limit>=K:
    print(1)
else:
    print(S[limit])

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

Solution (Python):
import numpy as np
S = np.array(list(map(str, input().rstrip())))
K = int(input())

cnt = 0
ans = 1

for i, s in enumerate(S):
    if s != "1":
        cnt = i+1
        ans = s
        break

if cnt > K:
    print(1)
else:
    print(int(ans))

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

if cou >= k:
    print(1)
elif cou < k:
    print(p)

Solution (Python):
def main():
    S = input()
    K = int(input())
    one_seq = sum([int(c) for c in S[:min([K, len(S)])]])
    if one_seq == min([K, len(S)]):
        print(1)
    else:
        for c in S:
            if c != '1':
                print(c)
                return


if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):



S = list(input())
s_len = len(S)
K = int(input())


pos = 0
while K>0:
    K -= 1
    if int(S[pos])==1:
        pos += 1
    else:
        K += 1
        break
    if pos==s_len:
        pos -= 1
        break


if K==0:
    print(S[pos-1])
else:
    print(S[pos])

Solution (Python):
inf = 10 ** 15
mod = 10 ** 9 + 7

s = input()
k = int(input())
count1 = 0
other = ''
for c in s:
    if c == '1':
        count1+=1
    else:
        other = c
        break
if other == '':
    print(1)
else:
    if k <= count1:
        print(1)
    else:
        print(other)

Solution (Python):
import sys


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


def resolve():
    def main():
        s = input()
        k = int(input())
        if int(s[0]) != 1:
            return s[0]
        else:
            cnt = 0
            for i in s:
                if int(i) == 1:
                    cnt += 1
                    if cnt >= k:
                        return 1
                else:
                    if cnt >= k:
                        return 1
                    else:
                        return i

    print(main())
resolve()

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

Solution (Python):





def main():
    S = list(map(int, input()))
    K = int(input())

    head = 0
    for i in range(len(S)):
        if S[i] > 1:
            head = i
            break
    
    if K == 1:
        return S[0]
    
    if K >= head+1:
        return S[head]
    else:
        return S[0]


print(main())

Solution (Python):
s = input()
k = int(input())
sw = 1
for i in range(min(len(s),k)):
    if s[i] != "1":
        t = s[i]
        sw = 0
        break
if sw == 0:
    print(s[i])
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 range(len(s)):
    if s[i] == '1':
        if i == k - 1:
            print(s[i])
            exit()
    else:
        print(s[i])
        exit()

Solution (Python):






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





min_idx = min((i for i in range(len(S)) if S[i] != "1"), default=-1)

if min_idx > K-1:
    print("1")
else:
    print(S[min_idx])

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

tmp = 0
for each in s:
  if int(each) > 1:
    print(each)
    break
  tmp += 1
  if tmp == k:
    print(1)
    break

Solution (Python):
s = input()
k = int(input())
i = 0
while True:
  if i == k-1:
    break
  elif s[i] == '1':
    pass
  else:
    break
  i += 1
print(s[i])

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
K = INT()


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

else:
	print(1)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
K = INT()


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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
K = INT()


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

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

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

Solution (Python):
n_l=list(input())
now=0
N=int(input())
if n_l[:N].count("1") == len(n_l[:N]):
   print(1)
else:
   for i in range(len(n_l)):
      if n_l[i] != "1":
         print(n_l[i])
         exit()

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

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from itertools import accumulate
def resolve():
    S=input()
    K,=pin()
    cnt=0
    for s in S:
        if s=="1":
            cnt+=1
            if cnt>=K:
                print(1)
                return
        else:print(s);return

resolve()

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

print("1")

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

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

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

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

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

Solution (Python):
def main():
    S=input()
    K=int(input())
    for s in S:
        if s=='1':
            if K==1:
                print(1)
                exit()
            K -= 1
            continue
        print(s)
        exit()
main()

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

flag  = 0

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

if flag == 0:
    print("1")

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

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

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

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

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

Solution (Python):
s = input()
k = int(input())
for c in s:
    if c != "1":
        break

    k -= 1
    if k == 0:
        break
print(c)

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

for i in range(len(str(S))):
    if int(str(S)[i]) == 1:
        if (K-1) == i:
            print(int(str(S)[i]))
            break
        continue
    else:
        print(int(str(S)[i]))
        break

Solution (Python):
import re
S=str(input())
k=int(input())

if set(S)=={'1'}:
  print(1)
  
else:
  x=re.search(r'[2-9]',S).start()
      
  if S[0]=='1':
    if k<=x:
      print(S[0])
    else:
      print(S[x])     
  else:
    print(S[0])

Solution (Python):

"""
Created on Sat May  9 16:54:06 2020

@author: shinba
"""

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

cnt = 0

while s[cnt] == "1":
    cnt += 1
    if cnt == len(s):
        break

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

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

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))

def main():
    s = input()
    k = int(input())
    one = 0
    while s[one] == '1':
        one += 1
        if not one < len(s):
            break
    if one >= k:
        print(1)
    else:
        print(s[one])

if __name__ == '__main__':
  main()

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

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

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

    for i, c in enumerate(s, start=1):
        if c == '1': continue
        if i <= k:
            print(c)
            return
    print(1)


if __name__ == '__main__':
    main()

Solution (Python):

import sys


def solve(S: int, K: int):
    for i, s in enumerate(str(S)[:K]):
        if s != '1':
            return s
    return 1


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))  
    print(solve(S, K))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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

    print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
s = list(input())
k = int(input())
cnt = 0
for c in s:
    if c != '1':
        ans = c
        break
    cnt += 1
    if cnt == k:
        ans = 1
        break
print(ans)

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

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

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

ans = 1
index = 0
for j in range(len(S)):
    if S[j] != '1':
        ans = int(S[j])
        index = j
        break

if ans == 1:
    print(ans)
elif index > K-1:
    print(1)
else:
    print(ans)

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

for i in range(min(N,len(S))):
    if S[i] != "1":
        print(S[i])
        quit()

print(1)

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

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

l = len(S)
one = 0
el = S[0]
for i in range(l):
    if S[i]=='1':
        one += 1
    else:
        el = S[i]
        break
if K<=one:
    print(1)
else:
    print(el)

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

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

first_not_1=-1
for i,s in enumerate(S):
    if s=="1":
        continue
    else:
        first_not_1=i
        break

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    res = 1
    idx = 0
    for i in range(len(s)):
        if s[i] != "1":
            res = s[i]
            idx = i + 1
            break

    if k < idx:
        print(1)
    else:
        print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
S = input()
K = int(input())
for x in S:
    x = int(x)
    if x != 1:
        print(x)
        break
    else:
        if K == 1:
            print(x)
            break
        else:
            K -= 1

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = readline().rstrip().decode()
k = int(read())
for ss in s:
    ss = int(ss)
    if ss > 1:
        print(ss)
        break
    else:
        if k > 1:
            k -= 1
        else:
            print(ss)
            break

Solution (Python):
import sys
input = sys.stdin.readline
S = list(map(int, list(input())[: -1]))
K = int(input())
x = 0
for i in range(len(S)):
  if S[i] == 1: x += 1
  else: break
if K <= x: print(1)
else: print(S[x])

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  


S = input()
K = read_a_int()


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

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

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

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

cnt = 0
for v in s:
  if v == "1": cnt += 1
  else: break
  if cnt == k: break
print(v)

Solution (Python):
n=input()
k=int(input())
counter=0
nex=0
for i in range(len(n)):
  if n[i]=='1':
    counter+=1
  else:
    nex=n[i]
    break
if nex==0:
  nex='1'
if k>counter:
  print(nex)
else:
  print(1)

Solution (Python):
def main():
    S = input()
    K = int(input())
    ans = "1"
    for i, s in enumerate(S):
        if s == "1":
            continue
        else:
            if i+1 <= K:
                ans = s
            break
    print(ans)


if __name__ == '__main__':
    main()

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

for i in range(k):
    if s[i]=='1':
        k-=1
        if k==0:
            print(s[i]);exit()
        continue
    else:
        print(s[i])
        break

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

u=input().rstrip()
k=I()
for i in range(k):
    if u[i]=="1":
        continue
    else:
        print(u[i])
        sys.exit()
print("1")

Solution (Python):
def main():
    s = list(input())
    k = int(input())
    if max(s[:k]) == '1':
        print(1)
        return 0
    for i in s:
        if i > '1':
            print(i)
            return 0

if __name__ == '__main__':
    main()

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

notone = 1
notonei = 101
for i, n in enumerate(s):
    if n != "1":
        notone = int(n)
        notonei = i
        break

if k <= notonei:
    print(1)
else:
    print(notone)

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

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

Solution (Python):
import sys
import math

s=input()
k = int(input())
cnt = False
ans=0
for i in range(0,k):
    if s[i] != '1':
        ans = s[i]
        cnt = True
        break
if (not cnt):
    print(1)
else:
    print(ans)

Solution (Python):
import sys

s = input()
k = int(input())
cnt = 0
for i in range(len(s)):
    if s[i] != "1":
        break
    cnt += 1
if cnt >= k:
    print("1")
    sys.exit()

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

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

one=0

for i in s:
    if i=='1':
        one+=1
    else:
        break

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

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

    tmp = ''
    count = 0
    for s in S:
        if s == '1':
            count += 1
        else:
            tmp = s
            break

    if count >= K:
        print('1')
    else:
        print(tmp)


if __name__ == "__main__":
    main()

Solution (Python):
s = input()
k = int(input())
k = k-1
def not1(t):
    for i in range(len(t)):
        if t[i] != '1':
            return (i, t[i])
    return (-1, '1')
(j, t) = not1(s)
if j == -1:
    print('1')
    exit()
if k < j:
    print('1')
    exit()
if k >= j:
    print(t)
    exit()

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

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

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

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

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

Solution (Python):


import sys






















def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    k = ii()
    if k == 1:
        print(s[0])
    else:
        cnt = 0
        first = 0
        for i in range(len(s)):
            if s[i] == '1':
                cnt += 1
            else:
                first = i
                break
        if k <= cnt:
            print('1')
        else:
            print(s[first])


if __name__ == "__main__":
    main()

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


def solve(s, k):
    for i in range(k):
        if s[i] != '1':
            return s[i]
    return '1'


if __name__ == '__main__':
    main()

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

for char in S:
    if char == "1":
        one += 1
    else:
        break

if K <= one:
    print(1)
elif one > 0:
    print(S[one])
else:
    print(S[0])

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

if k==1:
    print(int(s[0]))

elif int(s[0])==1:

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

    else:
        if s[:k]=="1"*k:
            print(1)
        else:
            num=1
            for i in range(1, len(s)):
                if int(s[i])!=1:
                    num=int(s[i])
                    break
            print(num)

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

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

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

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

Solution (Python):
def main(s: str, k: int):
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            return

    print(1)


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

    main(s, k)

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

Solution (Python):
S = input()
K = int(input())
if len(S) >= K and S[:K].count("1") == K:
    print(1)
else:
    for c in S:
        if c != "1":
            print(c)
            break

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=input()
k=int(input())
cnt=0
for i in range(len(S)):
    if S[i]=="1":
        cnt+=1 
    else:
        temp=S[i]
        break 
if k<=cnt:
    print(1)
else:
    print(temp)

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

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

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

Solution (Python):
n = input()
k = int(input())
if k == 1:
    print(n[0])
else:
    for i in range(len(n)):
        if int(n[i]) >= 2:
            print(n[i])
            exit()
        elif i+1 == k:
            print(n[i])
            exit()

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

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

Solution (Python):
s = input()
k = int(input())
if set(s[:min(k, len(s))]) == {'1'}:
    print(1)
else:
    for si in s[:min(k, len(s))]:
        if si != '1':
            print(si)
            break

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

s0 = 0

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

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

ans = 0
s0 = 0

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

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

for i, si in enumerate(S):
    if si != '1' and i < K:
        print(si)
        break
    elif i == K-1:
        print(1)

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

print(ans)

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

Solution (Python):
s = list(input())
k = int(input())
cur = 1
for c in s:
    if c != "1":
        print(c)
        break
    else:
        if cur == k:
            print(c)
            break
        cur += 1

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

if sum(map(int, list(s[:k]))) == len(s[:k]):
    print('1')
else:
    ans = s.replace('1', '')[0]
    print(ans)

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

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

Solution (Python):

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

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

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

Solution (Python):
n=str(input())
N = int(n)
m=int(input())
cnt = 0
for i in range(m):
    if i >= N:
        break
    if n[i] == "1":
        cnt +=1
    else:
        break
      
    
if cnt == m:
    print(1)
elif cnt == 0:
    print(n[0])
elif  cnt < m:
    print(n[cnt])

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

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

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

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

ans = 1

for s_i in s:
  if s_i == '1':
    k -= 1
    if k == 0: break
  else:
    ans = int(s_i)
    break
  
print(ans)

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

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

Solution (Python):
def main():
    S = input()
    K = int(input())
    idx = 0
    num = ""

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

    if count_one >= K:
        print("1")
    else:
        print(num)

if __name__ == "__main__":
    main()

Solution (Python):

import sys


def solve(S: int, K: int):
    K -= 1
    for c in str(S):
        if c == "1":
            K -= 1
        else:
            K = -1
        if K < 0:
            print(c)
            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 = input()
K = int(input())

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

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