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

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

Solution (Python):
s=input()
k=int(input())
for i in s:
  if i!='1':
    print(i)
    break
  else:
    k-=1
    if k==0:
      print(i)
      break

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

ones = 0
v = 0
for s in S:
    if s == '1':
        ones += 1
    else:
        v = s
        break

if ones >= K:
    print(1)
else:
    print(v)

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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


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

    return '1'


print(ans())

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

Solution (Python):
def mi():
    return map(int, input().split())

def ii():
    return int(input())

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

if __name__ == '__main__':
    main()

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

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

print(ans)

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

ts=s[:k]
if ts.count('1')==len(ts):
  print(1)
  exit()

for i in s:
  if i!='1':
    print(i)
    exit()

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

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

Solution (Python):
s = input()
k = int(input())
f = True
for si in s[:k]:
    if si != "1":
        print(si)
        f = False
        break
if f: 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):
import sys
s=input()
k=int(input())
for i in range(len(s)):
    if s[i]!="1":
        print(s[i])
        sys.exit()
    if s[i]=="1" and i+1==k:
        print(1)
        sys.exit()

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



num = 1


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

Solution (Python):
S = str(input())
K = int(input())
s  = ""
for i in range(len(S)):
  if(S[i]=="1"):
    s += S[i]
  else:
    s+=S[i]
    break
if(K>=len(s)):
  print(s[-1])
else:
  print("1")

Solution (Python):
S = input()
K = int(input()) - 1
    
rot = 10 ** 30 + 7

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

Solution (Python):
s=input()
k=int(input())
cnt=0
i=0
while s[i] =="1" and i<=len(s):
    cnt+=1
    i+=1
    if i==len(s):
        break


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

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

Solution (Python):
X=5*10**15
S = input()
k = int(input())

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

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

Solution (Python):

S = list(input())
K = int(input())
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
    elif i == K - 1:
        print('1')
        exit()

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    S = readline().strip().decode()
    K = int(readline())
    if S[0] != '1':
        print(S[0])
        return 

    cnt = 0
    for i in S:
        if i == '1':
            cnt += 1
        else:
            break
    if K <= cnt:
        print('1')
    else:
        print(S[cnt])
if __name__ == '__main__':
    main()

Solution (Python):
import sys
s=input()
k=int(input())
if k<=100:
  if s[:k]=='1'*k:
    print(1)
    sys.exit()
for i in s:
  if i!='1':
    print(i)
    break

Solution (Python):
S = input()
K = int(input())
mem = 1
for i in S:
  if i != "1" or mem == K: 
    print(i)
    break
  mem += 1 
else: print("1")

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

f = True
for i in range(k):
    if s[i] == 1:
        continue
    else:
        print(s[i])
        f = False
        break
if f:
    print(1)

Solution (Python):
s=list(input())
k=int(input())
x=0
ans=0
while x<len(s) and s[x]=="1":
  x+=1
if x>0:
  if k<=x:
    ans=1
  else:
    ans=s[x]
else:
  ans=s[0]

print(ans)

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

print(ans)

Solution (Python):
s=int(input())
s=list(str(s))
k=int(input())
i=0
while True:
  if i==len(s):
    print(1)
    break
  if s[i]!="1":
    print(s[i])
    break
  else:
    i=i+1
  if i==k:
    print(1)
    break

Solution (Python):
s=list(map(int,list(input())))
k=int(input())
cnt1=0
for si in s:
  if si==1:
    cnt1+=1
  else:
    break
if k<=cnt1:
  print(1)
else:
  print(s[cnt1])

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

if set(s[:K]) == {"1"}:
	print("1")
else:
	for ss in s:
		if ss != "1":
			print(ss)
			break

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

k=0
for s in S:
  s = int(s)
  k += 1
  if not s == 1:
    print(s)
    sys.exit()
  elif k == K:
    print(1)
    sys.exit()

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

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

Solution (Python):
import sys

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

for i in range(len(S)):
    if i+1 <= K and S[i] != '1':
        print(S[i])
        sys.exit()

print(1)

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

Solution (Python):
import sys

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

for n in s[:k]:
    if int(n) > 1:
        print(n)
        sys.exit()
print(1)

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

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


if __name__ == "__main__":
    main()

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

Solution (Python):
S = input()
K = int(input())
total = 0
for n in S:
    if n == "1":
        total += 1
        if total == K:
            print(1)
            break
    else:
        print(n)
        break

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

    def cut(s):
        for c in s:
            yield c
            if c != '1': break

    *s, = cut(S)
    if len(s) < K:
        print(s[-1])
    else:
        print(s[K - 1])


if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

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

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

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

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

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

Solution (Python):

s = list(input())

k = int(input())

cnt = 0

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

Solution (Python):
s = input()+"2"
k = int(input())

for i,j in enumerate(s):
    if j != "1":
        now = i
        break

if s == "1"*len(s):
    print(1)
else:
    if k-1 < now:
        print(1)
    else:
        print(s[now])

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

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

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

one = 0

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

if one >= K:
  print("1")
else:
  print(notone)

Solution (Python):
import sys

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


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


if __name__ == '__main__':
    resolve()

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

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):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    k=int(input())
    if s[0]!='1':
        print(s[0])
    else:
        cnt=0
        tugi=''
        for i in s:
            if i=='1':
                cnt+=1
            else:
                tugi=i
                break
        if cnt>=k:
            print('1')
        else:
            print(tugi)
resolve()

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):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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

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


if __name__ == '__main__':
    main()

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

Solution (Python):


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

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

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

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

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

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):
S=list(input())
S=list(map(int,S))
K=int(input())

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

Solution (Python):

import math


def inp():
    return(int(input()))



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



def instr():
    s = input()
    return(list(s[:len(s)]))



def invr():
    return(map(int, input().split()))


a = input()
k = inp()
i = 0
while i < len(a) and a[i] == '1':
    i += 1

if i >= k:
    print(1)
elif len(a) == i:
    print(1)
else:
    print(a[i])

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

days = 5*10*15

for s in S:
    si = int(s)
    if si == 1:
        k -= 1
    else:
        k -= si**days

    if k <= 0:
        print(si)
        break

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

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

flag = 0

if(K<= len(lista)):
  for i in range(K):
    if(lista[i] != "1"):
      flag = 1
      ans = lista[i]
      break
  if(flag == 0):
    print(1)
  else:
    print(ans)

else:
  i = 0
  while True:
    if(lista[i] != "1"):
      print(lista[i])
      break
    i+= 1

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

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

print(1)

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

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()
    K = int(input())

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

    print(ans)


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())
for i in range(min(len(S), K)):
  if(S[i] != '1' and S[i] != '0'):
    print(int(S[i]))
    exit()
print(1)

Solution (Python):
S = list(map(int, input()))
K = int(input())
if len(S) == 1:
    print(S[0])
    exit()

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

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

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

if __name__ == '__main__':
    main()

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

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

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

not_1_idx = -1
not_1_num = 1
for i, c in enumerate(S):
    if c != "1":
        not_1_idx = i
        not_1_num = c
        break
if not_1_idx >= 0:
    print(1) if K < not_1_idx + 1 else print(not_1_num)
else:
    print(not_1_num)

Solution (Python):
S = list(map(int, input()))
K = int(input())
count = 0
for a in S:
    if a == 1:
        count += 1
        if count == K:
            print(1)
            exit()
    else:
        print(a)
        exit()

Solution (Python):
s=input()
k=int(input())
cnt=0
for ss in s:
  if ss=='1':
    cnt+=1
  else:
    break
if cnt==0:
  print(s[0])
  exit()
if k<=cnt:
  print(1)
else:
  print(s[cnt])

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

Solution (Python):
S = input()
K = int(input())
n = 0
if K <= len(S) and all([s == '1' for s in S[:K]]):
  print('1')
else:
  for s in S:
    if s != '1':
      print(s)
      exit()

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

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

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

Solution (Python):

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


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

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

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

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

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

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

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

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

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

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):
import sys
def I(): return int(sys.stdin.readline().rstrip())
def S(): return sys.stdin.readline().rstrip()
S,K = S(),I()
count_1 = 0
for x in S:
    if x=='1':
        count_1 += 1
    else:
        if K>count_1:
            print(x)
            break
else:
    print(1)

Solution (Python):
import sys
s = str(input())
n = int(input())
i = 0
while True:
    if int(s[i]) == 1:
        if (n-1) == i:
            print("1")
            sys.exit()
        else:
            i += 1
    else:
        print(s[i])
        sys.exit()

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

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

Solution (Python):
def resolve():
	s = list(input())
	k = int(input())
	for i in range(len(s)):
		if int(s[i]) == 1:
			continue
		else:
			for j in range(i, len(s)):
				s[j] = s[i]
	if k < len(s):
		print(s[k-1])
		return
	print(s[-1])
resolve()

Solution (Python):
s = input()
n = int(input())
i = 0
while s[i]=="1":
    if n==i+1:
        print(1)
        exit()
    i+=1
    if i==len(s):
        break

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

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

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

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

if s[0] == '1' and len(s) == 1:
  print(1)
  exit()
elif s[0] != '1':
  print(s[0])
  exit()

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

Solution (Python):
S = list(map(int,list(input())))
K = int(input())
for i in range(K):
    if S[i] == 1:
        continue
    else:
        print(S[i])
        exit(0)
print(1)

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



def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

LINF = int(1e18+7)
S = input().rstrip()
K = int(input().rstrip())

tmp = LINF
ch = '1'
for i in range(len(S)):
  if S[i] != '1':
    tmp = i
    ch = S[i]
    break

if tmp >= K:
  print(1)
else:
  print(ch)

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

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

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

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

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

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

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

print(1)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


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


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





S = S()
K = I()
n = len(S)
ind = 0
num = 1
for i in range(n):
  if S[i] != "1":
    ind = i
    num = S[i]
    break
if K>ind:
  P(num)
else:
  P(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(k):
    if s[i] != "1":
        c=s[i]
        break

print(c)

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

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

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

k = int(input())

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

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

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

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())
one = 0
for i in range(len(S)):
  tmp = S[i]
  if(tmp == "1"):
    one += 1
  else:
    ans = tmp
    if(one >= K):
      print("1")
      exit()
    else:
      print(str(ans))
      exit()
print("1")

Solution (Python):
ns = list(map(int,input()))
n = int(input())
cnt = 1
ans = 0

for i in range(len(ns)):
  if (ns[i] == 1 and n == cnt) or ns[i] != 1:
    ans = ns[i]
    break
  else:
    cnt += 1
print(ans)

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

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

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

if len(S)==1:
    print(S)
    quit()

i=0
while i<len(S) and i<K:
    if S[i]!="1":
        print(S[i])
        quit()
    i+=1

print(1)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18


s = S()
k = I()
ans = 1
for i in range(k):
    if i < len(s) and 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
  if i == k-1:
    print(1)

Solution (Python):
from collections import deque
d = deque(list(input()))
k = int(input())

while len(d)!= 0:
    x = d.popleft()
    if x != '1':
        print(x)
        exit()
    else:
        k -= 1
        if k == 0:
            print(1)
            exit()

Solution (Python):
s = input()
k = int(input())
if s[0] != "1":
  print(s[0])
  quit()
c = 0
while s[c] == "1":
  c += 1
  if c == len(s):
    print(1)
    quit()
if c < k:
  print(s[c])
else:
  print(s[k-1])

Solution (Python):

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = np.array(list(sr()))
K = ir()
S = S[:K]
if np.all(S == '1'):
    answer = '1'
else:
    i = np.where(S != '1')[0][0]
    answer = S[i]

print(answer)

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
K = ir()
S = S[:K]
if len(set(S)) == 1 and S[0] == '1':
    answer = 1
else:
    for s in S:
        if s != '1':
            answer = s
            break

print(answer)

Solution (Python):
S = input()
K = int(input())
if S[:K].count('1') == K:
    print('1')
else:
    print(S.replace('1','')[0])

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

for i in range(min(len(s), k)):
    if int(s[i]) > 1:
        print(s[i])
        exit(0)

print(1)