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=list(input())
k=int(input())
for i in range(k):
    if s[i]!='1':
        print(s[i])
        quit()
print(1)

Solution (Python):



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

'''part = 0

for i in s:
  i = int(i)
  part += i**after
  if k <= part:
    print(i)
    break'''

s_k = s[:k]
sk1_count = s_k.count('1') 

if sk1_count == k:
  print(1)
else:
  for i in s:
    i = int(i)
    if i != 1:
      print(i)
      break

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

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

if k < f:
	print(1)
else:
	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):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
	
def main():
	S = input()
	S = list(S)
	K = int(input())
	
	if len(S) == 1:
		print(S[0])
		sys.exit()
		
	tmp = -1
	for i, val in enumerate(S):
		if int(val) != 1:
			tmp = int(i)+1
			break
	
	if K >= tmp:
		print(S[tmp-1])
	else:
		print(1)
	
if __name__ == "__main__":
	main()

Solution (Python):
n=list(input())
k=int(input())
if len(n)==1 and n[0]=='1':
  print('1')
else:
  one_list=[]
  while len(n)!=0:
    if n[0]=='1':
      one_list.append(n.pop(0))
    else:
      break
  if k<=len(one_list):
    print('1')
  else:
    print(n[0])

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

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

k = 1
for i in range(len(S)):
    if S[i] == 1:
        if k < K:
            k += 1
            continue
        else:
            print(1)
            exit()
    else:
        print(S[i])
        exit()

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

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

Solution (Python):
"""
Sの文字列、最初が何かに依存しそう
"""


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

if S[0] == "1":
    len_one = 0
    flag = 0
    for s in S:
        if s == "1" and flag == 0:
            len_one += 1
        elif flag == 0:
            save_num = s
            flag = 1
        else:
            flag = 1
    if K <= len_one:
        ans = 1
    else:
        ans = int(save_num)

else:
    ans = int(S[0])

print(ans)

Solution (Python):
S = input()
K = int(input())
while S[0] == '1' and len(S) > 1 and K > 1:
    S = S[1:]
    K -= 1
print(S[0])

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

flag = 1
i = -1

while (flag == 1) : 
    i += 1
    
    if N[i] == 1 : 
        if K > 1 : 
           K = K -1
        else : 
            print(1)
            flag = 0
    else : 
        print(N[i])
        flag = 0

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

flag = 1
i = -1

while (flag == 1) : 
    i += 1
    
    if N[i] == 1 : 
        if K > 1 : 
           K = K -1
        else : 
            print(1)
            flag = 0
    else : 
        print(N[i])
        flag = 0

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input()
    k = f()[0]

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

solve()

Solution (Python):

import sys
from itertools import *


def solve(S: str, K: int):
    onelen = len(list(takewhile(lambda x:x=="1",S)))
    res = "1" if onelen >= K else S[onelen]
    print(res)
    return



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

if __name__ == '__main__':
    main()

Solution (Python):

import sys


def solve(S: str, K: int):
    for i,s in enumerate(S):
        if s != "1":
            print(s)
            return
        elif i == (K - 1):
            print(s)
            return
    return



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

if __name__ == '__main__':
    main()

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


check = 0

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


print('1')

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

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

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

Solution (Python):
from sys import stdin

S = stdin.readline().rstrip()
K = int(stdin.readline().rstrip())

for x in range(len(S)):
    if int(S[x]) > 1:
        print(S[x])
        break
    if K == x + 1:
        print('1')
        break

Solution (Python):
S = input()
K = int(input())
if len(S) == 1:
    print(S)
else:
    ind = 0 
    while True:
        if S[ind] != '1':
            break
        ind += 1
        if ind == len(S):
            break
    if K <= ind:
        print('1')
    else:
        print(S[ind])

Solution (Python):

"""
C - To Infinity
https://atcoder.jp/contests/abc106/tasks/abc106_c

"""
import sys

def solve(S, K):
    leading_1 = 0
    infinity_ch = '@'
    for s in S:
        if s == '1':
            leading_1 += 1
        else:
            infinity_ch = s
            break
    if K <= leading_1:
        return '1'
    else:
        return infinity_ch


def main(args):
    S = input()
    K = int(input())
    ans = solve(S, K)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

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

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

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

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

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

if K <= ones:
    print(1)
else:
    print(num)

Solution (Python):



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

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

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


def main():
    count = 0

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

        count += 1
        if count == K:
            return '1'


print(main())

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

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

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


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

Solution (Python):
li = [ int(it) for it in input()]
K = int(input())


big = 1e19

def pows(v,p):
  _p = p
  r = 1
  t = v
  for i in range(100000):
    if (r>big):
      return big
    if (_p%2)==1:
      r *= t
    _p//=2
    if (_p==0):
      return r
    t **= 2

m = 0
for it in li:
  m += pows(it,5000000000000000)
  if (m>=K):
    print (it)
    break

Solution (Python):
import re

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

n1 = re.search("[2-9]", S)
if not n1:
	print("1")
	exit()

n1i = n1.start()
print(S[min(n1i, K - 1)])

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

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

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


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


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


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance





def main():
    s = input()
    k = intin()

    for i, c in enumerate(s):
        if i + 1 >= k:
            print(c)
            return
        if c != '1':
            print(c)
            return

    print(s[-1])


if __name__ == '__main__':
    main()

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

c = 0
a = 1
for si in s:
    if si == "1":
        c += 1
    else:
        a = si
        break

print("1" if k - c <= 0 else a)

Solution (Python):



import sys

S = [int(x) for x in input()]
K = int(input())

for s in S[:K]:
    if s != 1:
        print(s)
        sys.exit()
print(1)

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


def main():
    for i, s in enumerate(S):
        if s != '1':
            if K > i:
                print(s)
            else:
                print(1)
            return
    print(1)


main()

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


i = 0
for i in range(K):
    if int(S[i]) > 1:
        print (int(S[i]))
        sys.exit()
print (int(S[K-1]))

Solution (Python):
s = input()
k = int(input())
s = s[:k]
for c in s:
    if c == '1':
        continue
    else:
        print(c)
        break
else:
    print(1)

Solution (Python):

s = input()
k = int(input())
flag = False

for i in range(len(s)):
    if s[i] != '1':
        if k > i:
            print(s[i])
        else:
            print(1)
        flag = True
        break
if flag is False:
    print(1)

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

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

print(ans)

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

"""
Sが2なら22,3なら333,4なら4444
nならstr(n)*n
5000兆日後のK文字目は何か

1234
1223334444
12222333333333444444444444444
i日後にはn^i増えてる

"""


if S[0] == "1":
    for ind,s in enumerate(S):
        if s != "1":
            break
    ind += 1
    if K < ind:
        print(1)
    else:
        print(s)
else:
    print(S[0])

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":
        break

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

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

one = -1

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

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

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

for x in s:
  if x != '1':
    print(x)
    exit()
  else:
    count+=1
    if count >= k:
      print(1)
      exit()

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

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

Solution (Python):
str = map(int,list(input()))
k = int (input())
counter = 1
for i in str :
  if i != 1 :
    ans = i
    break
  ans = 1
  if counter >= k:
      break
  counter += 1
print(ans)

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

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

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

print(ans)

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

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

Solution (Python):
S=input()
K=int(input())
i=0
while S[i]=="1" and i+1<K and i<len(S):
    i+=1
print(S[i])

Solution (Python):
def searchInf(s, k):
    l = k if len(s) >= k else len(s)
    for i in range(l):
        if s[i] == "1":
            continue
        else:
            print(s[i])
            return 0
    print(1)
    return 0


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

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

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

    if i == k - 1:
        print('1')
        break

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

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

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

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

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

Solution (Python):
S = input().strip()
K = int(input().strip())
for i in range(K):
  if S[i] == '1':
    continue
  else:
    print(S[i])
    exit()
print(S[K-1])

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

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


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

if k<=cont1:
    print("1")
else:
    print(lastdig)

Solution (Python):
import numpy as np
from copy import deepcopy

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

if S[0] != '1': 
  ans = S[0]
elif S == '1'*len(S): 
  ans = '1'
else: 
  n_1 = 0
  for i in range(len(S)):
    if S[i] == '1':
      n_1 += 1
    else:
      first_num = S[i]
      break
  if n_1 >= K:
    ans = '1'
  else:
    ans = first_num
    
print(ans)

Solution (Python):

N = input()
K = int(input())
ans = 0
for i in range(min(K, len(N))):
    if int(N[i]) != 1:
        ans = N[i]
        
        break
print(ans if ans != 0 else 1)

Solution (Python):

import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


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


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

if __name__ == '__main__':
    main()

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

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

Solution (Python):

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

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

Solution (Python):

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

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

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

cnt_1 = 0

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


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

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

print(ans)

Solution (Python):

import numpy as np
import math
import re

S = input()
K = input()

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

Solution (Python):

import numpy as np
import math
import re

S = input()
K = input()

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

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

for i in range(min(len(s_input),k)):
    if s_input[i]!="1":
        print(s_input[i])
        exit()
print("1")

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

x = 1

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

print(x)

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


for i in range(len(n)):
  if i == k-1 or i == len(n)-1:
    print(n[i])
    exit()
  else:
    if n[i] != "1":
      print(n[i])
      exit()

Solution (Python):
S = input()
K = int(input())
if (K <= len(S)) :
    if (S[:K] == '1'*K) :
        print('1')
    else:
        for ch in list(S):
            if (ch != '1'):
                print(ch)
                break
else :
    for ch in list(S):
        if (ch != '1'):
            print(ch)
            break

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

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

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

Solution (Python):
S=input()
K=int(input())
if K<=len(S) and S[:K]=="1"*K :
    print(1)
else:
    for i in range(K):
        if S[i]!="1":
            print(S[i])
            quit()

Solution (Python):
s=input()
k=int(input())
if len(s) >= k and sum(list(map(int, s[:k]))) == len(s[:k]):
    print(1)
    exit()
for si in s:
    if int(si) > 1:
        print(si)
        exit()

Solution (Python):


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

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

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

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

flag = True
for i in range(k):
    if s[i] != '1':
        temp = s[i]
        flag = False
        break
if flag:
    print(1)
else:
    print(temp)

Solution (Python):


def solve():
    S = input()
    K = int(input())
    INF = 5000000000000000

    

    now_k = 1
    for s in S:
        num = int(s)

        if now_k == K:
            print(num)
            return
        
        if num != 1:
            
            print(num)
            return
        
        now_k += 1
        



if __name__ == "__main__":
    solve()

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

Solution (Python):

def main():
    data = list(map(int, list(input())))
    index = int(input())

    for i in range(index):
        if data[i] != 1:
            print(data[i])
            break
    else:
        print(data[i])



if __name__ == '__main__':
    main()

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())
if sum(list(map(int, s[:k]))) == len(s[:k]):
    print(1)
    exit()

for si in s:
    if si!='1':
        break

print(si)

Solution (Python):
S = input()
K = int(input()) -1
cnt = 0
ans = -1
while int(S[cnt]) == 1:
    if K == cnt:
        break
    cnt += 1
print(S[cnt])

Solution (Python):

import sys


def solve(S: int, K: int):
    for i in range(K):
        c = S[i]
        if c != '1':
            print(c)
            return
    print(1)
    return


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

if __name__ == '__main__':
    main()

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

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

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

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

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

Solution (Python):
S = input()
K = int(input())
i = 0
leng = len(S)
while S[i] == "1":
    i += 1
    if i >= leng:
        break
if K-1 < i:
    print(1)
else:
    print(int(S[i]))

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

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

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

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

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

Solution (Python):
def c():
    S = input()
    S = list(S)
    K = int(input())
    one = 0
    if K == 1:
        print(S[0])
        return 0
    else:
        for k in S:
            if k!="1":
                print(k)
                return 0
            else:
                one+=1
                if one == K:
                    print(1)
                    return 0
    print(1)
    return 0
if __name__ == '__main__':
    c()

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

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

for i in range(len(S)):
    if S[i] != '1':
        r = S[i]
        r_n = i
        break
else:
    print(1)
    exit()

if K <= r_n:
    print(1)

else:
    print(int(r))

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

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

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

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

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

import random
for i, v in enumerate(s):
    if v != "1":
        break
after = "1" * i + v * 100
print(after[min(len(s), k) - 1])

Solution (Python):
s = str(input())
k = int(input())
if len(set(s)) == 1 and "1" in s:
    print(1)
elif s.count("1") > k:
    print(1)
else:
    for i in range(len(s)):
        if s[i] != "1":
            print(s[i])
            break

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

ans=0

for i in range(k):
  N = int(S[i])
  
  if N == 1:
    ans = 1
  else:
    ans = N
    break  
print(ans)

Solution (Python):
from sys import stdin
S = stdin.readline().rstrip()
K = int(stdin.readline().rstrip())
if set(S[:K]) == {'1'}:
    print(1)
else:
    for s in S:
        if s != '1':
            print(s)
            break

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

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

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

ans = "1"
for i in range(K):
    if i >= len(S):
        break

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

print(ans)

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

    if not not_one:
        print('1')

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


count1 = 0
for c in S:
    if c == '1':
        count1 += 1
    else:
        break
next_c = c

if K <= count1:
    print('1')
else:
    print(next_c)

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

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

Solution (Python):

import sys
INF = float("inf")


def solve(S: str, K: int):

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

    return


def main():

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


if __name__ == '__main__':
    main()

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

c = 0
d = 1
for s in S:
  if s == '1':
    c += 1
  else:
    d = int(s)
    break

if c >= K:
  print(1)
else:
  print(d)

Solution (Python):
S = input()
K = int(input())
count = 0
flag = True

for s in S:
    if s == '1' and flag == True:
        count += 1
    else:
        flag = False

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

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

a=0
for i in s:
  if i==1:
    a+=1
  else:
    break
if k<=a:
  print(1)
else:
  print(s[a])

Solution (Python):
S = [int(i) for i in input()]
K = int(input())
for num,i in enumerate(S):
    if i!=1:
        print(i)
        break
    else:
        if num==K-1:
            print(i)
            break

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

if S[0] != "1":
  print(S[0])
  exit()
  
else:
  index = 10**18+1
  for i in range(2,10):
    tmp = S.find(str(i))
    if 0< tmp < index:
      index = tmp
      ans = i
  if index <= K-1:
    print(ans)
  else:
    print(1)

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

oneRow = 0

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


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