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-----
1214
4

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

Solutions:
S = input()
K = int(input())

if len(S) == 1:
    print(S)
else:
    flg = False
    while S[0] == '1':
        S = S[1:]
        K -= 1

        if K == 0:
            print(1)
            flg = True
            break
    
    if not flg:
        if S[0] == '2':
            if K.bit_length() - 1 >= 5000000000000000:
                print(S[1])
            else:
                print(S[0])
        else:
            print(S[0])

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

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

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

s = list(map(str, input().rstrip()))
k = int(input())

ans = 1
for x in s[:k]:
    if int(x) != 1:
        ans = int(x)
        break
print(ans)


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

i = 0
ans = 1
while i < K:
    if S[i] != '1':
        ans = S[i]
        break
    i += 1
print(ans)


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

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

import sys

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


s=list(s)

c=0
for i in range(len(s)):
        if s[i]=='1':
                c+=1
if c==len(s):
        print('1')
        return

d=0
if len(s)>=k:
        for i in range(k):
                if s[i]=='1':
                        d+=1
if d==k:
        print('1')
        return

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

#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
s = input()
k = I()
where = 0
while where < len(s):
    if s[where] == '1':
        where += 1
    else:
        break
print(('1' if k <= where else s[where]))


S=input()
a=int(input())
List=list(S)
res = 1
for i in range(a):
  if List[i] != "1":
    res = List[i]
    break
print(res)

# coding = SJIS

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

ans = 1

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

print(ans)

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


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

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

ones = 0
inf = None
for c in S:
    if c=='1':
        ones += 1
    else:
        inf = c
        break

if K <= ones:
    print('1')
else:
    print(inf)

S = input()
K = int(input())
def main():
    cnt = 1
    for i in S:
        if i == '1':
            if K == cnt:
                return '1'
            else:
                cnt += 1
                continue
        else:
            return i
        return '1'
print(int(main()))

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

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




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

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

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

def main():
    S = list(input())
    K = int(input())
    for i in range(min(K, len(S))):
        if S[i] != '1':
            print((S[i]))
            return
    print('1')
    return

def __starting_point():
    main()

__starting_point()

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

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

s=input()
k =int(input())
for i in range(k):
    if s[i] != '1':
        ans = s[i]
        break
    elif i < k-1:
        ans = s[i+1]
    else:
        ans = s[i]
        
print(ans)

# author:  Taichicchi
# created: 11.10.2020 20:40:13

import sys

S = input()

K = int(input())

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

print(ans)


s = input()
s = str(s)
k = int(input())
n = len(s)
for i in range(n):
    if s[i]!="1":
        break

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



s = str(input())
k = int(input())
if s[:k].count('1') == len(s[:k]):
    print(1)
else:
    for i in s:
        if i != '1':
            print(i)
            break

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

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

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

def main():
    s = input()
    k = int(input())
    ans = 0
    tyou = 500000000000000
    for v in s:
        if v == '1':
            ans += 1
        else:
            ans += tyou ** int(v)
        if ans >= k:
            print(v)
            return


def __starting_point():
    main()
__starting_point()

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

for j in range(len(S)):
    if S[j]=='1':
        if j==K-1:
            ans=1
            break
    else:
        x=[i for i in S if i!='1']
        ans=x[0]
        break

print(ans)


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

s=list(input())

k=int(input())

cnt=0
ans=0
for i in s:
  if int(i)==1:
    cnt+=1
    continue
    
  else:
    ans+=int(i)
    break
    
if k<=cnt:
  print((1))
  
else:
  print(ans)


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

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

ans = ""
if ref == 0:
    ans = S[0]
else:
    if ref >= K:
        ans = "1"
    else:
        ans = S[ref]

print(ans)

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

s = str(input())
k = int(input())
len_s = len(s)
cnt_1 = 0
for i in range(len_s):
    if s[i] == '1':
        cnt_1 += 1
    else:
        moji = s[i]
        break
if cnt_1 >= k:
    print(1)
else:
    print(s[i])

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

res = []
for c in S:
    res.append(c)
    if c != 1:
        break
print((res[min(len(res) - 1, K - 1)]))


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

S = str(input())
N = int(input())
Ones = 0
nxt = ""
for i in range(len(S)):
  if S[i] == "1":
    Ones += 1
  else:
    nxt = S[i]
    break
if N <= Ones:
  print((1))
else:
  print(nxt)


s=input()
k = int(input())
cnt = 0
for i in s:
    if i == '1':
        cnt +=1
    else:
        x = i
        break
if cnt >= k:
    print(1)
else:
    print(x)

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

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

l = 0
for i in range(len(S)):
    if S[i] == '1':
        l += 1
    if l >= K:
        print((S[i]))
        return
    if S[i] != '1':
        print((S[i]))
        return


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

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

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


s = str(input())
ss = [int(i) for i in s]
k = int(input())
if sum(ss) == len(s):
  print("1")
  return
count = 0
while s[count] == "1":
  if k == count + 1:
    print("1")
    return
  count += 1
print(s[count])

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

# 5 * 10^15
cnt = 0

for i in range(len(S)):
    if int(S[i]) == 1:
        cnt += 1
    else:
        if cnt >= K:
            print(1)
        else:
            print(int(S[i]))
        return

print(1)

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

i = 0
while i<len(S) and S[i]=='1':
    i += 1

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

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

if k == 1:
    print(int(s[0]))
elif s[0] == "1":
    cnt = 0
    while  cnt < len(s) and s[cnt] == "1" :
        cnt += 1
    if cnt >= k:
        print(1)
    elif cnt == len(s):
        print("1")
    else:
        print(s[cnt])
else:
    print(int(s[0]))

S = input()
K = int(input())
one = 0

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

if K<=one:
  print(1)
else:
  print(ans)

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

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

import sys, math
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
s = lines.pop(0)
k, = [int(num) for num in lines.pop(0).split(" ")]
days = 5000 * (10 ** 12)
for n in s:
    log_k = math.log10(k)
    n = int(n)
    log_n_days = math.log10(n) * days
    if log_k > log_n_days:
        k -= n ** days
    else:
        break
print(n)


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

cnt_one = 0
for i in S:
    if i == '1':
        cnt_one += 1
    else:
        break

if cnt_one >= K:
    print(1)
else:
    print(S[cnt_one+1-1])

S = input()
K = int(input())
OK = True
for i in range(min(K, len(S))):
    if S[i] != '1':
        OK = False
if OK:
    print('1')
    return
for i in range(len(S)):
    if S[i] != '1':
        print((S[i]))
        return


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

# ABC-106-C
S = input().rstrip()
K = int(input())


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

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

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

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

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

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

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

#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    S = input().rstrip()
    k = int(input())
    
    for i in range(k):
        if S[i]!="1":
            break
    print(S[i])

def __starting_point():
    main()
__starting_point()

s = list(input())
s = list(map(int,s))
k = int(input())
for _ in s[:k]:
    if _ != 1:
        print(_)
        return
print(1)

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

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

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

# coding: utf-8


def main():
    S = input()
    K = int(input())
    ans = '1'
    tmp = -1
    for i, s in enumerate(S):
        if s != '1':
            ans = s
            break
        else:
            tmp = i

    if K - 1 <= tmp:
        ans = '1'

    print(ans)

def __starting_point():
    main()

__starting_point()

N = list(input())
N = [int(N[i]) for i in range(len(N))]
K = int(input())
if len(N) < K:
  for i in range(len(N)):
    if not N[i] == 1:
      print((N[i]))
      break
  else:
    print((1))
else:
  for i in range(K):
    if not N[i] == 1:
      print((N[i]))
      break
  else:
    print((1))


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

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

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

s1=0
sn1='0'
for i in range(len(s)):
    if(s[i] == '1'):
        s1+=1
    else:
        sn1=s[i]
        break
ans='0'
if(s1>=k):
    ans='1'
else:
    ans=sn1

print(ans)

S = input()
N = len(S)
K = int(input())

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

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

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

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

print((S[K-1]))


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


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

s = input()
k = int(input())
n = 5000 * 10**12

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


s=input()
k=int(input())
d=5*10**15
for i in s:
  if i=='1':
    k-=1
  else:
    print(i)
    return
  if k<=0:
    print(1)
    return

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush

input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]

def mod_pow(x,n):
    res = 1
    while n > 0:
        if n & 1:
            res = res * x
            x = x * x
            n >>= 1
    return res


def main():
    S = input().rstrip()
    K = I()
    for i in range(len(S)):
        if int(S[i]) >= 2 or K == 1:
            print(S[i])
            break
        else:
            K -= 1
            
        
    
    
def __starting_point():
    main()
__starting_point()

s = input()
k = int(input())
one_cnt = 0

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

if k <= one_cnt:
  print(1)
  return

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

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

for i in range(K):
    if int(S[i])>1:
        print(S[i])
        return

print(1)

# 解説を参考に作成
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(S, K):
    ans = ''
    for i in range(len(S)):
        if i + 1 == K:
            ans = S[i]
            break
        if S[i] != '1':
            ans = S[i]
            break
    print(ans)


def __starting_point():
    S = input()
    K = int(input())
    # N, M = map(int, input().split())
    # A = [int(i) for i in input().split()]
    # B = [int(i) for i in input().split()]
    # AB = [[int(i) for i in input().split()] for _ in range(N)]
    solve(S, K)

    # # test
    # from random import randint
    # from func import random_str
    # solve()

__starting_point()

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

n=input()
k=int(input())

for i in range(len(n)):
    if n[i]=="1" :
        k-=1
        if k==0 :
            print((1))
            break
    else :
        print((n[i]))
        break


s = input()
k = int(input())
cnt = 0
for j in range(len(s)):
	cnt += 1
	if s[j] == "1":
		if cnt == k:
			print("1")
			return
	else:
		print((s[j]))
		return


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


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

S = list(map(int,input()))
K = int(input())
flag = False
ans = 1
for i in range(K):
  if S[i] != 1:
    flag = True
    ans = S[i]
    break
print(ans)

# -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 01:17:00 2020

@author: liang
"""

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

#count = 0
for i in range(len(S)):
    if S[i] != '1':
        break
#print("i",i)

if K < i + 1:
    print((1))
    #print("A")
else:
    print((S[i]))
    #print("B")


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

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

s = input()
k = int(input())
cnt = 0
for i in s:
    if int(i) == 1:cnt += 1
    if cnt == k or int(i) != 1:
        print(i)
        break

s=input()
i=1
while 1:
    if i==len(s)+1:
        print((1));return
    if s[i-1]!="1":
        t=i 
        ans=int(s[i-1])
        break
    i+=1
# print(t)
if int(input())<t:
    print((1));return
print(ans)


def main():
  S=input()
  K=int(input())
  cnt=0
  n=0
  for i in S:
    if i=='1':
      cnt+=1
    else:
      n=int(i)
      break
  if cnt>=K:
    print(1)
  else:
    print(n)
  return
main()

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

if k == 1 or len(s) == 1:
    ans = list(s)[0]
else:
    ans = None
    for i, j in enumerate(list(s)):
        if i < k-1:
            if j != '1':
                ans = j
                break
        elif i == k-1:
            ans = j           
            break
        else:
            continue
print(ans)

def number_count(string, n):
    count = 0
    for i in range(len(string)):
        if int(string[i]) == n:
            count += 1
    return count


def main():
    s = str(input())
    k = int(input())

    if number_count(s, 1) == len(s):   # sの中身がすべて１の場合
        number = '1'

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

        if k < first_index + 1:
            number = '1'
        else:
            number = s[first_index]


    print(number)


def __starting_point():
    main()
__starting_point()

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

S = input()
K = int(input())
con = 0
for i in S:
  if i == '1':
    con += 1
  else:
    break
if con >= K:
  print((1))
else:
  print(i)
  


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


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

print(s[i])

S=input()
K=int(input())
a=''
n=0

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


s = input()
k = int(input())
i = 0
while True:
  if s[i] == '1':
    if k <= i+1:
      print('1')
      break
    else:
      i += 1
  else:
    print(s[i])
    break

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

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

for i,s in enumerate(S):
  if s != "1" and i < K: 
    print(s)
    return
print(1)

S = input()
K = int(input())
count = 0

if S[0] != '1':
  print(S[0])
  return

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

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

import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    S = ins()
    K = ini()
    ones = 0
    for i, d in enumerate(S):
        if d != "1":
            break
        ones += 1
    if K <= ones:
        return "1"
    return S[ones]


print(solve())


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

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


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

c = s.count('1',0,k)

x = s.replace('1', '')

if len(x)==0:
    print(1)
else:
    if c ==k:
        print(1)
    else:
        print(x[0])

s=[int(i) for i in list(input())]
k=int(input())

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

import sys

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

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