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

s_left = '1'
num_1 = 0

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

if K <= num_1:
    ans = '1'
else:
    ans = s_left


print(ans)

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

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

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

    else:
        for l in range(0, k):
            if int(s[l]) != 1:
                print(int(s[l]))
                break

            if l == k - 1:
                print(1)

elif s[0] == "1" and k == 1:
    print(1)

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

Solution (Python):
S = list(map(int,input()))
K = int(input())
a = []
for i in range(len(S)):
    a.append(S[i])
    if S[i] != 1:
        break
if K >= len(a):
    print(a[-1])
else: print(1)

Solution (Python):
S = list(input())
S.append('0')
K = int(input())
i = 0
while S[i] == '1':
    i += 1
if K > i:
    print(int(S[i]))
else:
    print(1)

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

S_set_under_K = set(S[:K])

if len(S) == 1:
    print(S)
elif len(S_set_under_K) == 1 and S_list[0] == 1:
    print(1)
else:
    for c in S:
        if c != "1":
            print(c)
            exit()

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

for i in range(min(len(S), K)):
    if S[i] > "1":
        print(S[i])
        exit()
print("1")

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

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

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

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

Solution (Python):
def main():
    S = input()
    K = int(input())
    for i in range(len(S)):
        if S[i] != '1':
            can = S[i]
            cannum = i + 1
            break
    print('1' if set(S) == {'1'} or K < cannum else can)

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    S = input()
    K = int(input())
    N = len(S)
    for i in range(N):
        if S[i] != '1':
            can = S[i]
            cannum = i + 1
            break
    if set(S) == {'1'} or K < cannum:
        print(1)
    else:
        print(can)

if __name__ == '__main__':
    main()

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

answer = 0
for i in S:
    i_int = int(i)
    t = K**(1/5000000000000000)
    if t <= i_int:
        answer = i_int
        break
    else:
        K = K - 1
print(answer)

Solution (Python):
s=input()
lists=[int(integer)for integer in s] 
nums=int(input())

numbers=0 
strong=0 


for j in lists:
    if lists[0]!=1:
        break
    else:
        if j==1:
            numbers+=1
        else:
            break

if lists[0]==1:
    if numbers>=nums:
        print(1)
        
    elif numbers<nums:
        print(lists[numbers])
else:
    print(lists[0])

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

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

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

limit = n if n < k else k

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

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

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

ck = 0
for i in S:
  if i == '1':
    K -= 1
  else:
    print(i)
    exit()
  if K == 0:
    print(i)
    exit()

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

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

if(k == 1):
    print(n[0])
elif(len(n)==1):
    print(n)
elif(n[0]== '1'):
    i = 1
    while(n[i] == '1'):
        i += 1
        if(i == len(n)):
            break
    if(k <= i):
        print(1)
    else:
        print(n[i])
else:
    print(n[0])

Solution (Python):
N = list(input())
K = int(input())
for i in range(K) :
  a = int(N[i])
  if a!=1:
    print(a)
    exit()
print(1)

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

Solution (Python):
string = input()
pos = int(input())

while pos > 1 and (len(string) > 0 and string[0] == '1'):
  pos -= 1
  string = string[1:]
  
if len(string) == 0:
  print('1')
elif pos == 1:
  print(string[0])
elif string[0] == '1' and len(string) > 1:
  print(string[1])
else:
  print(string[0])

Solution (Python):
s = input()
k = int(input())
index = 0
c = s[0]
for i, a in enumerate(s):
  if a != '1':
    index = i
    c = s[i]
    break
if index < k:
  print(c)
else:
  print(1)

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

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

is_one = True
for i,c in enumerate(s[:k]):
  if c!='1':
    is_one = False
    break
    
if is_one:
  print(1)
else:
  print(int(s[i]))

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

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

s = input().split() 
s = list(s[0])
s = list(map(int,s))

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

Solution (Python):

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

idx = 0
last = 0
a11_one = True

for i in range(len(s)):
    if s[i:i+1] == '1':
        idx = i
    else:
        last = s[i:i+1]
        a11_one = False
        break
if k==1:
    print(s[0:1])
    exit()
if a11_one:
    print('1')
else:
    print('1' if k-1 <= idx else last)

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

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

Solution (Python):
n = int(input())
k = int(input())
ans = []
ln = list(map(int, list(str(n))))
for i,name in enumerate(ln):
    ans.append(name)
    if name != 1:
        break

ans_len = len(ans)

print(ans[min((k-1), (ans_len - 1))])

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

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 = [int(s) for s in input()]
K = int(input())
if set(S[:K]) == {1}:
    print(1)
else:
    for i in S:
        if i != 1:
            print(i)
            break

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

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

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

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

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

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

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007



s = S()
k = I()

index = -1
for i in range(len(s)):
    if s[i] != '1':
        ans = s[i]
        index = i
        break


if  k > index >= 0:
    print(ans)
else:
    print(1)

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

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

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

count = 0
for i in range(len(s)):
    c = s[i]
    if c != '1':
        if k <= count:
            print('1')
        else:
            print(c)
        break
    else:
        count += 1
else:
    print('1')

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

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

index = -1
r = -1
for i in range(len(S)):
    if index == -1:
        if S[i] == '1':
            index = i
            r = 1
            continue

    if index != -1 and r != 0:
        if S[i] == '1':
            r += 1
        else:
            break
if index == -1:
    print(S[0])
elif index != 0:
    print(S[0])
elif r >= N:
    print(1)
else:
    print(S[r])

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

Solution (Python):
import os, sys, re, math

def oneidx(S):
    idx = -1
    for s in S:
        if s == '1':
            idx += 1
        else:
            break
    return idx

S = input()
N = int(input()) - 1
idx = oneidx(S)

if idx >= N:
    print('1')
else:
    print(S[idx+1])

Solution (Python):
import sys

s = input()
k = int(input())
target = '1'

s2 = s[:k]

if all(c == '1' for c in s2):
    print(1)
    sys.exit()





for c in s:
    if c != '1':
        target = c
        break

print(target)

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

for i, v in enumerate(s):
  if i + 1 == k or v > 1:
    print(v)
    break

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

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

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

    Slen = len(S)

    ans = 1
    for i in range(K):
        if i == Slen:
            break

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

    print(ans)


if __name__ == '__main__':
    func()

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

Solution (Python):
line = raw_input()
s = line
line = raw_input()
k = int(line)

ret = '1'
head = 0
for c in s:
    if c == '1':
        head += 1
        continue
    if head >= k:
        ret = '1'
    else:
        ret = c
    break    

print ret

Solution (Python):
import os, sys, re, math

lines = sys.stdin.readlines()

S = lines[0]
K = lines[1]

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

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

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

T = ""
for i in S:
    if i != "1":
        T += i
        break
    else:
        T += i
L = len(T)-1

if L >= K:
    print(1)
else:
    print(T[-1])

Solution (Python):
S=input()
k=int(input())
b=1
for s in S:
  if s!='1':
    a=s
    break
  elif b==k:
    a=s
    break
  else:
    b+=1
print(a)

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

for cnt, s_ in enumerate(s):
    if s_ == '1':
        if cnt+1 == k:
            print(1)
            break
    else:
        print(s_)
        break

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

c = "1"

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

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

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

if t == 0:
  print(s[0])
else:
  if k <= t:
    print('1')
  else:
    print(temp)

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

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

if t == 0:
  print(s[0])
else:
  if k <= t:
    print('1')
  else:
    print(temp)

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
S = input()
K = int(input())
day = 5 * 10 ** 15

for i in S:
    if i == '1':
        K -= 1
        if K == 0:
            print(1)
            exit()
        else:
            continue
    else:
        print(i)
        exit()

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

Solution (Python):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


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

L = min(len(S), K)
S = S[:L]

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

Solution (Python):
S = raw_input()
K = int(raw_input())
list_S = list(S)
for i in range(0,len(list_S)):
        if list_S[i] == "1":
                if i == (K-1):
                        del list_S[:]
                        list_S = ["1"]
                        break
        elif list_S[i] != "1":
                break

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

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

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

pos1 = len(s)
for i, v in enumerate(s):
  if v != "1":
    pos1 = i
    break
  
if k < pos1 + 1:
  print(1)
else:
  print(s[pos1])

Solution (Python):
import sys
S = input()
k = int(input())
cnt1 = 0
for s in S:
  if s != '1':
    print(int(s))
    sys.exit()
  else:
    cnt1 += 1
    if cnt1 >= k:
      print(1)
      sys.exit()
    continue
print(S[-1])

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

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

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

if __name__ == "__main__":
    main()

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

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

s = input()
k = ni()
keta = 0
for i in range(len(s)):
    if s[i] == "1":
        continue
    else:
        keta = i
        break
if k < keta + 1:
    print("1")
else:
    print(s[keta])

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())
if len(set(s)) == 1 and s[0] == '1':
    print(1)
else:
    i = 0
    while i < len(s) and s[i] == '1':
        i += 1
    if k <= i:
        print(1)
    else:
        print(s[i])

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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

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

    else:
        print(S[i])
        exit()

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

for i, si in enumerate(s):
    if si > 1:
        break

if k <= i + 1:
    print(s[k - 1])
else:
    print(si)

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

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

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

for i in map(int, s[:k]):
  if i != 1:
    print(i)
    break
else:
  print(1)

Solution (Python):
s = input()
k = int(input())
a = min(len(s),k)
z=1
for i in range(a):
	if s[i]=="1":
		pass
	else:
		z=s[i]
		break
print(z)

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

def check_one(sgn,arr):
    cnt = 0
    for i in range(sgn):
        if S[i] == '1':
            cnt += 1
    if cnt == sgn:
        return True

def first_num(arr):
    list = []
    for i in range(len(arr)):
        if arr[i] != '1':
            list.append(int(arr[i]))
    return list[0]
            

if len(S) >= K and check_one(K,S):
        print(1)
else:
    print(first_num(S))

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

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

Solution (Python):

import sys
import math
from collections import defaultdict


sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


mod = 10**9 + 7


def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))



S = str(input())
K = I()

p = -1
for i in range(len(S)):
    if S[i]!='1':
        p = i
        val = S[i]
        break

if p==-1:
    print(1)
elif p>=K:
    print(1)
else:
    print(val)

Solution (Python):
import re

s = input().split()[0]
k = int(input().split()[0])

m = re.search(r'[2-9]+', s)

if m:
    index = m.start()
    ans = m.group()[0] if index < k else '1'
else:
    ans = '1'

print(ans)

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

ans = 1

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

print(ans)

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

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

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

ans = 0

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

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

Solution (Python):
def main():
    S = input()
    K = int(input())
    i = 0
    while i < len(S) and S[i] == "1":
        i += 1
    if K <= i:
        return "1"
    else:
        return S[i]

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

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

pos = 1
for c in S:
    num = int(c)
    if num == 1 and pos < K:
        pos += 1
        continue
    else:
        print(num)
        break

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

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

print(ans)

Solution (Python):
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

mod = 1000000007

"""


    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())


    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    S = sys.stdin.readline().rstrip()
    K = int(sys.stdin.readline())

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

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

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

Solution (Python):
import sys

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

if len(s)==1:
    print(s)
else:
    if s[0]!='1':
        print(s[0])
    elif set(s)=={'1'}:
        print(1)
    else:
        for i in range(len(s)):
            if s[i]!='1':
                a=i
                if k<=a:
                    print(1)
                else:
                    print(s[i])
                break

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

one = 0
while one<len(s) and s[one]=='1':
    one += 1

ans = '1'
if k > one:
    ans = s[one]
print(ans)

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

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

Solution (Python):
import re

S = input().rstrip()
K = int(input())

reg = re.search(r'[2-9]', S)
if reg:
    i = reg.start()
else:
    i = len(S) + 1


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

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

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

for c in s:
  if c != '1':
    print(c)
    exit()
  else:
    k -= 1
    if k == 0:
      print(1)
      exit()
print(1)

Solution (Python):
def solve():
    s = input()
    k = int(input())
    head_ones = 0
    for c in s:
        if c != "1":
            break
        else:
            head_ones += 1

    return "1" if head_ones >= k else [c for c in s if c != "1"][0]


if __name__ == "__main__":
    print(solve())

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

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

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

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

isOne=True
for i in range(min(k, len(s))):
  if s[i]!="1":
    isOne=False
    ans=s[i]
    break
if isOne:
  print(1)
else:
  print(ans)

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

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



main()

Solution (Python):
s=list(input())
k=int(input())
ans="1"
l=len(s)

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

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

Solution (Python):
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])
    K = int(inputs[1])

    if len(S) == 1:
        return int(S[0])

    for i, c in enumerate(S):
        if c == '1' and K == i + 1:
            return 1
        elif c != '1':
            return int(c)

    
    
    
    
    
    
    


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)

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

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

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

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

if check == 0:
    ans = 1
else:
    if tmp > K :
        ans = 1
    else:
        ans = S[tmp-1]

print(ans)

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

if S[0] == "1" and K <= n:
    print(1)
elif S[0] == "1" and K > 1:
    print(S[n])
elif S[0] != "1":
    print(S[0])

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

s = input().strip()
k = int(input())

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

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

Solution (Python):

import sys


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

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

    print(S[K-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):


import collections
import itertools
import sys


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

s = input()
k = getint() - 1

t = list(itertools.takewhile(lambda s: s == '1', s))

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

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

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