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

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007



def main():
	s=input()
	k=int(input())
	for c in list(s)[:k]:
		if c != '1':
			print(c)
			return 
	print('1')
	
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

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()
n = int(input())

i = 0
while i != len(s) and s[i] == '1':
    i += 1

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

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

div = 0
for i in range(len(S)):
    if S[i] != "1":
        div = i
        break

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

Solution (Python):








import sys

sys.setrecursionlimit(10 ** 5 + 10)




def resolve():
    S = input()
    s = [int(c) for c in S]
    K = int(input())

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


resolve()

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

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

t=0
ans=1

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

if k>=t:
    print(ans)
else:
    print("1")

Solution (Python):
s = str(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()
k = int(input())
flag = False

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

if flag:
    print(ans)
else:
    print(1)

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    S=readline().strip()
    K=int(readline())

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

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

if __name__=="__main__":
    main()

Solution (Python):
S = input()
K = int(input())
lc1 = -1
while lc1 + 1 < len(S) and S[lc1 + 1] == '1':
    lc1 += 1

print("1" if lc1 + 1 >= K else S[lc1 + 1])

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

def main():
    S = input()
    K = int(input())
    if len(S) > K and S[K-1] == '1':
        print('1')
        exit()
    for i in list(S):
        if i != '1':
            print(i)
            exit()
    print('1')

if __name__ == '__main__':
    main()

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

if s[:k].count('1') == len(s[:k]):
    print(1)
else:
    for c in s:
        if c != '1':
            print(c)
            exit()

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
if count >= k:
    ans = 1
print(ans)

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

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

Solution (Python):
S=input()
K=float(input())
lis=list(S)
ss=set(lis)

if len(ss)==1:
  print(S[0])
else:
  if K<=len(S):
    check_list=lis[:int(K)]
    check_set=set(check_list)
    if len(check_set)==1:
      print(check_list[0])
    else:
      for num in lis:
        if int(num)!=1:
          print(int(num))
          break            
  else:
    for num in lis:
      if int(num)!=1:
        print(int(num))
        break

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

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

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

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

Solution (Python):

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


cnt = 0

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

if cnt >= k:
    print(1)
else:
    print(num)

Solution (Python):

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


cnt = 1

if len(s) == 1:
    print(s)
    exit()

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

if cnt >= k:
    print(1)
else:
    print(num)

Solution (Python):
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd



import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    S = input().strip()
    n = int(input().strip()) - 1
    m=0
    for i in range(len(S)):
        if S[i] != '1':
            m = i
            break
    if n < m:
        print("1")
        return
    else:
        print(S[m])
        return


if __name__ == '__main__':
    main()

Solution (Python):




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

    result = 1

    for s in S[:K]:
        if int(s) > result:
            result = int(s)
            break

    print(result)


if __name__ == "__main__":
    main()

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

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

print('1')

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

count = 0
while count < len(S):
    if S[count] == "1":
        count += 1
    else:
        break
if K > count:
    print(S[count])
else:
    print(1)

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

print(ans)

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

flag = True
for i in range(min(len(s),k)):
    if s[i] != 1:
        flag = False
    else:
        pass

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

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

flag = True
for i in range(min(len(s),k)):
    if s[i] != 1:
        flag = False
    else:
        pass

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

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

Solution (Python):
import sys

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

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

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

if k <= 100:
    a = 0
    for i in range(k):
        if s[i] != '1':
            break
        if i == str(k-1):
            print(1)
            sys.exit()
    print(s[i])
    
else:
    for i in range(100):
        if s[i] != '1':
            print(s[i])
            break

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

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":
        print(s[i])
        exit(0)
print(1)

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

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

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

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

ans = '1'

if s.count('1') == len(s) or k == 1 and s[k-1] == '1':
    print(1)
else:
    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
    else:
        pass
print(ans)

Solution (Python):
import bisect




import itertools



import sys



ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

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

    count1 = 0
    for i in range(len(s)):
        num = int(s[i])
        if num == 1:
            count1 += 1
            if count1 == k:
                print(1)
                sys.exit()
        if num != 1:
            print(num)
            sys.exit()

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

Solution (Python):
S = list(input())
for i in range(len(S)):
    S[i] = int(S[i])

K = int(input())

start = 1
loc = 101
for i in range(len(S)):
    if S[i] != 1:
        start = S[i]
        loc = i
        break

if K > 100:
    print(start)
elif K-1 >= loc:
    print(start)
else:
    print(1)

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

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

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

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

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

Solution (Python):
import sys

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

first = 0

for i in range(min(k,len(s))):
  if s[i] != '1':
    print(s[i])
    sys.exit(0)

print(1)

Solution (Python):
from sys import exit

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(k):
  if s[i]!='1':
    print(s[i])
    exit()
print(1)

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    S=list(map(int,list(input())))
    K=int(input())
    for n in S:
        if n==1:
            K-=1
            if K==0:
                print(1)
                exit()
        else:
            print(n)
            exit()

if __name__ == '__main__':
    main()

Solution (Python):
x=input()
m=int(input())
x=list(x)

if len(x)<m:
	m=len(x)
t=1
for i in range(m):
	if x[i]!='1' and t==1:
		t=x[i]
t=int(t)
print(t)

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

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

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

print(ans)

Solution (Python):
s = list(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):
a=input()
b=int(input())
if b<101:
  if a[:b]=='1'*b:print(1)
  else:
    k=0
    while a[k]=='1':k+=1
    print(a[k])
else:
  k=0
  while a[k]=='1':k+=1
  print(a[k])

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

len1s = 0
for i in range(len(s)):
    if s[i] == "1":
        len1s += 1
        continue
    else:
        res = s[i]
        break
else:
    res = "1"

if k <= len1s:
    ans = "1"
else:
    ans = res

print(ans)

Solution (Python):


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

    for i, c in enumerate(s, start=1):
        if c != "1":
            if i > k:
                break
            else:
                print(c)
                return

    
    print("1")
            

if __name__ == "__main__":
    submit()

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

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

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

Solution (Python):
s=input()
li=list(set([s[i] for i in range(len(s))]))
k=int(input())
c=0
for i in range(len(s)):
  if s[i] != "1":
    t = s[i]
    j=i
    c=1
    break
if c==0:
  print(1)
else:
  if j<=k-1:
    print(t)
  else:
    print(1)

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

Solution (Python):
s = input()
k = int(input())
lengh = 0
ans = '1'
flag = True
for i in list(s):
    if i != '1':
        ans = i
        break
if k <= len(s):
    for i in list(s)[:k]:
        if i == '1': continue
        flag = False
        break
    if flag: ans = s[k-1]
print(ans)

Solution (Python):


s = input().rstrip()
m = int(input().rstrip())

ans = s[0]
if m > 1:
    for i in range(m):
        if s[i] == "1":
            continue
        else:
            ans = s[i]
            break

print(ans)

Solution (Python):
s = input()
k = int(input())
f = True
c = 0
for i in s:
    if i=='1' and f: c+=1
    else: 
        f=False
        break
if c==0:
    print(s[0])
else:
    if c>=k: print(s[0])
    else: print(s[c])

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

    for ci, c in enumerate(s):
        if c != '1' and k >= ci + 1:
            print(c)
            exit()

    print('1')

if __name__ == "__main__":
    main()

Solution (Python):
s = input()
k = int(input())
if k <= 100:
    if set(s[:k]) == set('1'):
        print(1)
        exit()
for _ in s:
    if _ != '1':
        print(_)
        exit()

Solution (Python):
S = [int(n) for n in list(input())]
K = int(input())
c = 0
for i in range(len(S)):
	s = S[i]
	if s == 1:
		c += 1
	else:
		k = 0
		while c < K:
			c += k ** s
			k += 1
	if c >= K:
		print(s)
		break

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

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

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

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

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

print(1)

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
S=input()
K=int(input())
ans=''
i=0
while True:
    ans=S[i]
    if(K==(i+1)):
        print(ans)
        sys.exit()
    elif(ans=='1'):
        i+=1
    else:
        print(ans)
        sys.exit()

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

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

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

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

for i in range(len(s)):
    if s[i]=='1':
        if i == n-1:
            print(1)
            break
    else:
        print(s[i])
        break

Solution (Python):
print(max("1",input()[:int(input())].replace("1","")[:1]))

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

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

if not1==-1:
        print(1)
elif k > not1:
        print(s[not1])
else:
        print(1)

Solution (Python):
s = input()
s = [int(i) for i in s]
k = int(input())
if max(s) == 1:
	print(1)
	exit()
c = 0
for i in s:
	if i == 1: c += 1
	else: break
if k <= c:
	print(1)
else:
	for i in s:
		if i > 1:
			print(i)
			exit()

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

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

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

print(S[i])

Solution (Python):
def main():
    import sys
    
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    
    from itertools import combinations
    
    from math import floor, ceil

    

    s = input()
    k = int(input())
    n = 0
    while n<=k-1:
        if not s[n]=='1':
            print(s[n])
            exit()
        else:
            n += 1
    print('1')


if __name__ == '__main__':
    main()

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

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

    for i,s in enumerate(S):
        s = int(s)
        if s != 1:
            print(s)
            return
        if i+1 == k:
            print(1)
            return
    print(1)


if __name__ == '__main__':
    main()

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

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

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

cnt = 0
for i in S:
    if i == '1':
        cnt += 1
    else:
        if cnt == 0:
            print(i)
            exit()
        elif K <= cnt:
            print(1)
            exit()
        else:
            print(i)
            exit()
else:
    print(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())
def calculate(S,K):
    normalStart = 1
    firstOneArr = []
    for s in S:
        if s != "1":
            normalStart = int(s)
            break
        else:
            firstOneArr.append(1)
    if K > len(firstOneArr):
        print(normalStart)
    else:
        print(1)
calculate(S,K)

Solution (Python):
S = input()
K = int(input())
cnt = 1
for s in S:
    if s != '1':
        break
    else:
        cnt += 1


if K < cnt:
    ans = S[0]
else:
    ans = S[cnt - 1]

print(ans)

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

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

Solution (Python):
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = readline().decode().strip()
K = int(readline())
ans = 1
for i in range(K):
    if N[i] != '1':
        ans = N[i]
        break

print(ans)

Solution (Python):
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = readline().decode().strip()
K = int(readline())
cnt = 0
tmp = 0

for i in N:
    if i == '1':
        cnt += 1
        continue
    else:
        tmp = int(i)
        break
ans = N[tmp-1] if K <= cnt else tmp

print(ans)

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

if set(s[:k]) == set(['1']):
    print(1)
else:
    for x in s[:k+1]:
        if x != '1':
            print(x)
            break

Solution (Python):
s = input()

k = int(input())

ichi = 0
for i in s:
    if int(i) == 1:
        ichi = ichi +1
    else:
        break


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

Solution (Python):
import math

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

ss=[]
cont0=0
cont1=0
for i in range(len(s)):
    if s[i]!="1":
        ss.append(int(s[i]))
    else:
        if len(ss)==0:
            cont0=cont0+1
        else:
            cont1=cont1+1
        
k=k-cont0
    
n=5000*10000**3

if len(ss)==0:
    print(1)
elif k<=0:
    print(1)
else:
    logk=math.log10(k)

    logketa=n*math.log10(ss[0])
    if logketa>logk:
        print(ss[0])
    else:
        print(ss[1])

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

Solution (Python):
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')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()

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

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

print(1)

Solution (Python):
s = input()
K = int(input())
ind = 0
for i in range(len(s)):
    if s[i] != "1":
        ind = i
        break
    ind += 1

if ind == len(s):
    print(1)
else:
    if K <= ind:
        print(1)
    else:
        print(s[ind])

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

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

print(ans)

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

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

if (S[0] == '1' and K - 1 < num):
    ans = 1
elif (S[0] == '1'):
    ans = S[num]
else:
    ans = S[0]

print(ans)

Solution (Python):
s=[int(i) for i in list(input())]
k=int(input())-1
n=len(s)
flag=False
for i in range(n):
  if s[i]==1:
    if k<=i:
      print(1)
      break
  else:
    print(s[i])
    break

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 math
def main():
    s = input()
    n = int(input())
    for i, ss in enumerate(s):
        num = int(ss)
        if i < n:
            if num == 1:
                continue
            else:
                print(num)
                return
        else:
            print(1)
            return
    print(1)
    return
def powpow(a,n):
    x = 1
    i = 0
    while n > 0:

        if bin(n>>i & 1):
            x=x*a
        a*=a
        i+=1
        n=n>>1
    return x

if __name__=='__main__':
    main()

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 2019
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





s=list(ss())
k=ii()

500000000000000
5*10^14

if len(list(set(s)))==1:
    print(s[0])
    exit()

cnt=0
chk=True
ans=1
for i in range(len(s)):
    if chk and s[i]=="1":
        cnt+=1
    elif chk and s[i]!="1":
        chk=False
        ans=int(s[i])

    else:
        chk=False

if cnt >=k:
    print(1)
else:
    print(ans)

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


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

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

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

Solution (Python):
S=input()
K=int(input())
tmp = 0
for i in S:
    if i=='1':
        tmp += 1
    else:
        break
if K <= tmp:
    print(1)
else:
    print(S[tmp])

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

Solution (Python):

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

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

Solution (Python):
S = input()
K = int(input())
for s in S:
    if s != "1":
        print(s)
        exit()
    else:
        K -= 1
        if not K:
            print(1)
            exit()

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

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

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

cnt=0 
i=0
while True:
    if s[i]!='1': break
    else:
        cnt+=1
        i+=1
        if i>len(s)-1: break
        
print(1 if k<=cnt else s[cnt])

Solution (Python):

if __name__ == '__main__':
    S=list(input())
    K=int(input())
    S=[int(s) for s in S]
    for i in range(K):
        if S[i]!=1:
            print(S[i])
            break
        else:
            if i==K-1:
                print(1)

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

Solution (Python):
s = str(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())

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

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